Manager API Originate & CDRs - Getting dialed #


#1

I have an application that is generating dials based on the Originate command via the Manager API. The issue is, tht the CDR (in this case MySQL) is storing the last internal extension that the call qualified for as opposed to the dialed number in the ‘dst’ field.

For example, if I dial: IAX2/voipjet/14155551212 and then drop it in this context:

[code]context test {
s => {
BackgroundDetect(…)
};

 talk => {
      ...
 };

};[/code]

If voice/silence is detected (answering machine) it goes to the talk extension. The issue is, that ‘talk’ appears (as opposed to 14155551212) in the ‘dst’ field of the CDR. How do I get the number dialed in there?


#2

Anyone have any ideas on this?


#3

have you tried setting the ${EXTEN} variable as the first thing done in the talk context? first you would need to set a variable in the s extension, like:

[s]
exten => _.,1,Set(numDialled=${EXTEN})
…blah blah…

[talk]
exten => _.,1,Set(EXTEN=numDialled)
…blah blah…

just a thought…not sure it will work

i believe that using the _. extension isn’t such a serious mistake in version 1.2+ because i think i’ve noticed that it no longer includes s,t,i, etc.


#4

The call is actually initiated as an Originate via the ManagerAPI and I have actually tried to obtain the ${EXTEN} and it ‘appears’ to be blank. So what I have done is set a variable (ie - ${DIALED}) which is the number dialed when we initiate the Originate and then have been inserting that in the userfield in the CDR table.

It may just work to set the ${EXTEN} to ${DIALED} in the ‘talk’ extension to trick Asterisk into setting the dst back to what it should be, the number dialed. Will give it a try, thanks!