Change CDR dst field according to last dialed number

Hello everyone,

In my dialplan I have a following piece:

[incomming_call] exten => 222222222,1,NoOp(incomming call) exten => 222222222,n,Dial(SIP/555555555@provider) exten => 222222222,n,NoOp(do other stuff, if unsuccessfull)

My problem is that I can’t reflect the call to 555555555 in CDRs (I always get 222222222 in CDR dst field). I found that the only way to change CDR dst field to 555555555 is by jumping to another context with Goto and execute that Dial command there. However in that case I’m not able to come back to my original context to execute whatever follows the Dial command (NoOp(do other stuff, if unsuccessfull)).

Please help me resolve this.

You could use subroutines.

Depending on what exactly you do afterwards, and how the call ends, you may or may not get a CDR with the context and extension at the time of the Dial.

Just tried it. Works great calling Dial from a subroutine.

Thank you very much, david55