How to find RECIPIENT in extensions.conf on Asterisk 10.0.0

Hi,

I’m not sure if this is right forum to ask for this question but I’ll try.

Our company uses Asterisk 10.0.0 to receive voicemail. Now, I need to update it to support IVR. I’m an inch close to complete the changes but there is one hurdle. I need to use the ‘RECIPIENT’ phone number in the extensions.conf.

So far, with hard coding, I can achieve the goal as follows:

[incoming]
switch => Realtime/@extensions
exten => 100,1,Answer()
exten => 100,2,VoiceMail(949111111, d([outgoing]))
exten => 100,4,Hangup()

exten => a,1,DIAL(“SIP/1585111111@outgoing”)
exten => a,2,Hangup()

FYI:
All calls are forwarded using single extension 100 to Asterisk server. As per the above extensions.conf setting, when a request is received for extension 100 and the caller presses ‘*’, the call will be forwarded to 585111111. That works successfully.

What I need is to replace the hardcoding of 949111111 with a variable which is the actual field.

Any help is appreciated.

I just found one way to achieve it by reading the Diversion header and than program to fetch the value.

Is there any better way?

Although I didn’t understand what you meant by RECIPIENT (surely that is just ${EXTEN}), looking at your solution suggests you may want https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information#ManipulatingPartyIDInformation-REDIRECTINGdialplanfunction

Thanks for the response…

Let me provide some more info. I’ve multiple numbers Voicemail forwarded to Asterisk using a single extension (eg. 100). In that case, the EXTEN provides me same value for all recipients. And let say the recipient numbers are: 949111111, 949111112, 949111113, 949111114, 949111115. Now, I need to play personal greetings for each recipient number when the caller reaches the voicemail. It’s not possible to find an individual message with single extension (100). Moreover, I read that VoiceMail() provides an option to pass all of those recipients in the param list but it will only play the greeting message of the first recipient in the list.

Let me share my solution in detail here, so it may help others (may not the best but this solution works):

exten => s,2,Set(FOO1=${SIP_HEADER(Diversion),2}) ; read the 2nd part of the Diversion header value
exten => s,3,Set(FOO1=${CUT(FOO1,:,2)}) ; Split the String by ‘:’ and get the 2nd part
exten => s,4,Set(FOO1=${CUT(FOO1,@,1)}) ; Split the String by ‘@’ and get the recipient mdn

This helped me to set the Recipient MDN in the variable FOO1.

Regards.

I think the article I referenced is relevant, particularly REDIRECTING.