[asterisk-dev] Setting the Caller ID - should it modify the CDR fields ?

Pavel Troller patrol at sinus.cz
Wed Apr 11 09:34:49 CDT 2012


Hi!
  Sorry for maybe not-so-core-devel question, but I didn't find an answer
anywhere and it makes me problems with billing/mediation system I'm writing,
so it's not totally off-topic here, I hope. The question is:
  If a callerid is modified by Set(CALLERID(num)=<number>), should the change 
be automatically copied to the CDR(src), CDR(clid) etc. fields, or not ? 
  My provisional answer is, that it depends on the channel technology, and I'm
not fully satisfied witch such an answer :-).

To demonstrate my question practically, I've prepared the following testing 
extension:
  
exten => 27,1,NoOp(CDR_SRC=${CDR(src)})
exten => 27,n,Set(CALLERID(num)=99999999)
exten => 27,n,NoOp(CDR_SRC=${CDR(src)})
exten => 27,n,Hangup()

When called from a SIP extension, it looks like this:
    -- Executing [27 at pbxdial:1] NoOp("SIP/2142-0000006a", "CDR_SRC=2142") in new stack
    -- Executing [27 at pbxdial:2] Set("SIP/2142-0000006a", "CALLERID(num)=99999999") in new stack
    -- Executing [27 at pbxdial:3] NoOp("SIP/2142-0000006a", "CDR_SRC=2142") in new stack
    -- Executing [27 at pbxdial:4] Hangup("SIP/2142-0000006a", "") in new stack
Here, the value is NOT changed.

When called from a DAHDI extension, it looks like this:
    -- Executing [27 at pbxdial:1] NoOp("DAHDI/5-1", "CDR_SRC=2237") in new stack
    -- Executing [27 at pbxdial:2] Set("DAHDI/5-1", "CALLERID(num)=99999999") in new stack
    -- Executing [27 at pbxdial:3] NoOp("DAHDI/5-1", "CDR_SRC=2237") in new stack
    -- Executing [27 at pbxdial:4] Hangup("DAHDI/5-1", "") in new stack
Here, the value is NOT changed.

When called from a IAX2 extension, it looks like this:
    -- Executing [27 at pbxdial:1] NoOp("IAX2/arcus-1464", "CDR_SRC=2412") in new stack
    -- Executing [27 at pbxdial:2] Set("IAX2/arcus-1464", "CALLERID(num)=99999999") in new stack
    -- Executing [27 at pbxdial:3] NoOp("IAX2/arcus-1464", "CDR_SRC=2412") in new stack
    -- Executing [27 at pbxdial:4] Hangup("IAX2/arcus-1464", "") in new stack
Here, the value is NOT changed.

And now, let's try the Local channel, it looks like this:
    -- Executing [27 at default:1] NoOp("Local/27 at default-a063;2", "CDR_SRC=2112") in new stack
    -- Executing [27 at default:2] Set("Local/27 at default-a063;2", "CALLERID(num)=99999999") in new stack
    -- Executing [27 at default:3] NoOp("Local/27 at default-a063;2", "CDR_SRC=99999999") in new stack
    -- Executing [27 at default:4] Hangup("Local/27 at default-a063;2", "") in new stack
The value IS changed there!

I know about at least one other channel example, which behaves like the Local
channel, but because it's not a part of the Asterisk source, I'm not taking
it into account here.
Because the Local channel is used in many cases, and because we are using the
CLI manipulation to for example prepend the trunk prefixes or for other
purposes, the result is, that in the CDRs there is a mix of original and 
converted numbers, which is not good. 
  Any ideas, how to unify the behaviour for all the channel technologies in
either way ?
  With regards,
  Pavel


P.S. Forgot to say - it's on 1.8 branch.



More information about the asterisk-dev mailing list