Single CDR with multiple Dial

Hi,

Is it possible to have single CDR for call that does multiple Dial? Example:

Wait(5);
Dial(SIP/Trunk/301,g);
Wait(5);
Dial(SIP/Trunk/302,g);
Wait(5);
Dial(SIP/Trunk/303,g);

This will create 3 CDRs, but I need one cumulative CDR that starts and ends when incoming call does.

Thank you

test following dialplan . I didnt test it but it should work as you want .

[mycontext]
exten => 1234,1,Dial(IP/Trunk/301&Local/Trunk302@mycontext&Local/Trunk303@mycontext)
exten => Trunk302,1,Wait5)
exten => Trunk302,n,Dial(IP/trunk/302)
exten => Trunk303,1,Wait10)
exten => Trunk303,n,Dial(IP/trunk/303)

Thank you for the idea, but unfortunately this wont work for me.

What I need is to receive a call and then dial two or more calls from my server to another location one after another, and for that I need just one CDR. Instead Asterisk creates two CDRs.

Your idea gave a little different result, but still no cumulative CDR.

This is what I have tried:

[mycontext]
exten => 1234,1,Dial(Local/301@DialOut,g)
exten => 1234,n,Wait(5)
exten => 1234,n,Dial(Local/302@DialOut,g)

[DialOut]
exten => _XXX,1,Dial(SIP/ExternalPBX/${EXTEN})

This creates two CDRs in mycontext and two CDRs in DialOut context. These two in DialOut context are actually wait time until answered at ExtenalPBX.

The easiest way is to do this in the billing software.

You could use a local channel to isolate the the incoming leg. There would be only one Dial application call, so only one CDR from the dialplan running on the actual incoming channel.

David, I’m not sure what do you mean. I have tried something like this:

[code][InContext]
exten => 1234,1,Dial(Local/s@macro-DialOut)

[macro-DialOut]
exten => s,1,Dial(Local/301@DialOut,g)
exten => s,n,Wait(5)
exten => s,n,Dial(Local/302@DialOut,g)
…[/code]

but as soon as 301 hangs up, call is disconnected.
I have temporary solved my problem by creating custom CDR in h extension, with Realtime_Store application, but this is not such a good way to do things like this.

You have either found a bug or you have confused Asterisk by trying to run a macro as though it was normal dialplan.

If you have found a bug, it is possible that the /n modifier on the Local channel dialstring may help.

Note that macros are deprecated, and new code should use subroutines.