C.59. ForkCDR()

Erstellt einen zusätzlichen CDR (Call Detail Record) aus dem aktuellen Anruf.
ForkCDR()
Erstellt für den Rest des aktuellen Anrufs einen zusätzlichen Call Detail Record, um die in Rechnung zu stellende Gesprächszeit von der Gesamtdauer des Anrufs zu unterscheiden.
exten => 123,n,ForkCDR()
Asterisk-Versionen:
————————| 1.2 |————————| 1.4 |————————| 1.6 |————————
Interner Hilfetext zu dieser Applikation in Asterisk 1.4:
  -= Info about application 'ForkCDR' =-

[Synopsis]
Forks the Call Data Record

[Description]
  ForkCDR([options]):  Causes the Call Data Record to fork an additional
cdr record starting from the time of the fork call
  Options:
    a  - update the answer time on the NEW CDR just after it's been inited..
         The new CDR may have been answered already, the reset that forkcdr.
         does will erase the answer time. This will bring it back, but.
         the answer time will be a copy of the fork/start time. It will.
         only do this if the initial cdr was indeed already answered..
    D -  Copy the disposition forward from the old cdr, after the .
         init..
    d -  Clear the dstchannel on the new CDR after reset..
    e -  end the original CDR. Do this after all the necc. data.
         is copied from the original CDR to the new forked CDR..
    R -  do NOT reset the new cdr..
    s(name=val) - Set the CDR var 'name' in the original CDR, with value.
                  'val'.
    v  - When the new CDR is forked, it gets a copy of the vars attached
         to the current CDR. The vars attached to the original CDR are removed
         unless this option is specified.
Differenz des internen Hilfetexts von Asterisk 1.2 zu 1.4:
--- in Asterisk 1.2
+++ in Asterisk 1.4
@@ -6,4 +6,20 @@
   [Description]
     ForkCDR([options]):  Causes the Call Data Record to fork an additional
   cdr record starting from the time of the fork call
-  If the option 'v' is passed all cdr variables will be passed along also.
+    Options:
+      a  - update the answer time on the NEW CDR just after it's been inited..
+           The new CDR may have been answered already, the reset that forkcdr.
+           does will erase the answer time. This will bring it back, but.
+           the answer time will be a copy of the fork/start time. It will.
+           only do this if the initial cdr was indeed already answered..
+      D -  Copy the disposition forward from the old cdr, after the .
+           init..
+      d -  Clear the dstchannel on the new CDR after reset..
+      e -  end the original CDR. Do this after all the necc. data.
+           is copied from the original CDR to the new forked CDR..
+      R -  do NOT reset the new cdr..
+      s(name=val) - Set the CDR var 'name' in the original CDR, with value.
+                    'val'.
+      v  - When the new CDR is forked, it gets a copy of the vars attached
+           to the current CDR. The vars attached to the original CDR are removed
+           unless this option is specified.
Differenz des internen Hilfetexts von Asterisk 1.4 zu 1.6:
--- in Asterisk 1.4
+++ in Asterisk 1.6
@@ -5,21 +5,82 @@

   [Description]
     ForkCDR([options]):  Causes the Call Data Record to fork an additional
-  cdr record starting from the time of the fork call
+  cdr record starting from the time of the fork call. This new cdr record will
+  be linked to end of the list of cdr records attached to the channel. The original CDR is
+  has a LOCKED flag set, which forces most cdr operations to skip it, except
+  for the functions that set the answer and end times, which ignore the LOCKED
+  flag. This allows all the cdr records in the channel to be 'ended' together
+  when the channel is closed.
+  The CDR() func (when setting CDR values) normally ignores the LOCKED flag also,
+  but has options to vary its behavior. The 'T' option (described below), can
+  override this behavior, but beware the risks.
+
+  Detailed Behavior Description:
+  First, this app finds the last cdr record in the list, and makes
+  a copy of it. This new copy will be the newly forked cdr record.
+  Next, this new record is linked to the end of the cdr record list.
+  Next, The new cdr record is RESET (unless you use an option to prevent this)
+  This means that:
+     1. All flags are unset on the cdr record
+     2. the start, end, and answer times are all set to zero.
+     3. the billsec and duration fields are set to zero.
+     4. the start time is set to the current time.
+     5. the disposition is set to NULL.
+  Next, unless you specified the 'v' option, all variables will be
+  removed from the original cdr record. Thus, the 'v' option allows
+  any CDR variables to be replicated to all new forked cdr records.
+  Without the 'v' option, the variables on the original are effectively
+  moved to the new forked cdr record.
+  Next, if the 's' option is set, the provided variable and value
+  are set on the original cdr record.
+  Next, if the 'a' option is given, and the original cdr record has an
+  answer time set, then the new forked cdr record will have its answer
+  time set to its start time. If the old answer time were carried forward,
+  the answer time would be earlier than the start time, giving strange
+  duration and billsec times.
+  Next, if the 'd' option was specified, the disposition is copied from
+  the original cdr record to the new forked cdr.
+  Next, if the 'D' option was specified, the destination channel field
+  in the new forked CDR is erased.
+  Next, if the 'e' option was specified, the 'end' time for the original
+  cdr record is set to the current time. Future hang-up or ending events
+  will not override this time stamp.
+  Next, If the 'A' option is specified, the original cdr record will have
+  it ANS_LOCKED flag set, which prevent future answer events
+  from updating the original cdr record's disposition. Normally, an
+  'ANSWERED' event would mark all cdr records in the chain as 'ANSWERED'.
+  Next, if the 'T' option is specified, the original cdr record will have
+  its 'DONT_TOUCH' flag set, which will force the cdr_answer, cdr_end, and
+  cdr_setvar functions to leave that cdr record alone.
+  And, last but not least, the original cdr record has its LOCKED flag
+  set. Almost all internal CDR functions (except for the funcs that set
+  the end, and answer times, and set a variable) will honor this flag
+  and leave a LOCKED cdr record alone.
+  This means that the newly created forked cdr record will affected
+  by events transpiring within Asterisk, with the previously noted
+  exceptions.
     Options:
-      a  - update the answer time on the NEW CDR just after it's been inited..
+      a - update the answer time on the NEW CDR just after it's been inited..
            The new CDR may have been answered already, the reset that forkcdr.
-           does will erase the answer time. This will bring it back, but.
+           does will erase the answer time. This will bring it back, but
            the answer time will be a copy of the fork/start time. It will.
            only do this if the initial cdr was indeed already answered..
-      D -  Copy the disposition forward from the old cdr, after the .
+      A - Lock the original CDR against the answer time being updated.
+           This will allow the disposition on the original CDR to remain the same.
+      d - Copy the disposition forward from the old cdr, after the .
            init..
-      d -  Clear the dstchannel on the new CDR after reset..
-      e -  end the original CDR. Do this after all the necc. data.
+      D - Clear the dstchannel on the new CDR after reset..
+      e - end the original CDR. Do this after all the necc. data.
            is copied from the original CDR to the new forked CDR..
       R -  do NOT reset the new cdr..
       s(name=val) - Set the CDR var 'name' in the original CDR, with value.
                     'val'.
+      T -  Mark the original CDR with a DONT_TOUCH flag. setvar, answer, and end
+            cdr funcs will obey this flag; normally they don't honor the LOCKED
+            flag set on the original CDR record.
+            Beware-- using this flag may cause CDR's not to have their end times
+            updated! It is suggested that if you specify this flag, you might
+            wish to use the 'e' flag as well!
       v  - When the new CDR is forked, it gets a copy of the vars attached
            to the current CDR. The vars attached to the original CDR are removed
            unless this option is specified.