Custom field in CDR table

Hi folks,
I have a strange issue. Let me explain and may be someone can suggest:

I have 2 sip phones. When sip1 dials to sip 2, i try to save a value in my cdr something like this:-
Set(CDR(callplan)=abc)
Dial(SIP/myext2,10,U(MyExtM^1))
so when the call is answered by myext2, the macro runs and in the Macro i do the following:-
[MyExtM]
exten => s,1,Set(CDR(callplan)=newansuser)
exten => s,n,Return()

when i check the cdr table, i see only abc in callplan field. i wanted to append whatever is already in the callplan.

Do you see any issue here?

You are running it on the wrong channel.

Actually i need Call-ID on both channels :wink:
is there anyway i can acheive this.
i need both callid’s appended by ;

I think you will need to use a shared or global variable, to copy it to a variable accessible from the A side.

I actually need callid of A side and on B side.
I can see ${SIP_HEADER(Call-ID)} on side A and Side B but the problem is i am not able to save them in the CDR(callplan). Only the A side is saved.

but A side is already saved no problem there. THe problem is with the B side. I can see B side Call-ID but the problem is, its not saved in the CDR(dialplan). I am not sure about the behaviour, is there anyway we can appendlike callidaxxx;callidbxxx ?
by the way the callid of B side shows correctly when i see on the screen.

You are saving it in the B side CDR, when you want it saved in the A side CDR. As already explained, you will probably need to use as shared or global variable, on the A side, which a hangup handler adds to the CDR.

Hi David,
Sorry let me try to understand, as you know currently i have only 1 cdr generated when i make a call from sipa to sipb. both are registered on the same asterisk box.
sipa calls to sipb, the call-id on sipa leg is xxxxa, and the sipb leg callid is xxxxxb. when i print logs i can see both callid’s without any issue. they both are different i can see on the asterisk console. The problem is only when i try to save them. If i run a hangup handler and try to save in the cdr how that will resolve my issue?

By running on the channel whose CDR will actually get output.

i tried the hangup handler on both channels but it does not seem to be working. can you please check for me ? thank you for your help David. here are the logs.
so when the call comes in i see the following
Set(“SIP/test1-00001c27”, “CHANNEL(hangup_handler_push)=hdlrSaveCh,s,1(1e4b8c607247aa0e)”)

When the call is answered in the macro i see the following.
“CHANNEL(hangup_handler_push)=hdlrSaveCh,s,1(617ff91c190c23e012f9b11a27d49516@1.1.1.1)”

now in the hdlrSaveCh i am doing the following.

[hdlrSaveCh]
exten => s,1,Verbose(callid is ${ARG1})
exten => s,n,Set(CDR(callid)=${ARG1})
exten => s,n,Return()

i can see only the first callid

You are going to have to use variables to get the value back to the A side channel.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.