Solved

Nesting Variables in Asterisk dialplan

Posted on 2011-03-03
7
711 Views
Last Modified: 2012-06-21
Hello experts,

In my asterisk dialplan, when user dials extension 1, sip trunk (GSM1) should be dialled, and an email should be sent to (Email1) address. The same with extension 2,3 and 4

I wrote this in my dialplan:

[gsmplan]

exten => _[1234],1,dial(SIP/siptrunk/GSM${EVAL(${EXTEN})},60)

exten => h,1,System(/usr/local/bin/sendEmail -f me@domain.com -t Email${EVAL(${Email1})} -m 'This is a test message' )

In the verbose, I am having:

Executing [1@gsmplan:1] Dial("SIP/user-0000064b", "SIP/siptrunk/GSM1,60") in new stack

The problem is that it's dialing GSM1 while it should be replaced with it's variable value.

Any help?
0
Comment
Question by:Muhajreen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
feptias earned 300 total points
ID: 35096703
Do you mean that you have a variable called GSM1??

If so, you have made two mistakes. First, the GSM must be within the EVAL brackets. Second, you are trying to use the Dahdi device format as the first argument to the Dial command, for a SIP call. SIP calls use a slightly different format for that first argument - for details see the section "Using the Dial Command with SIP Channels" at this link:
http://www.voip-info.org/wiki/index.php?page=Asterisk+SIP+channels

Try this:
    exten => _[1234],1,dial(SIP/${GSM${EXTEN}}@siptrunk,60)
 ...or this
    exten => _[1234],1,dial(SIP/${EVAL(GSM${EXTEN})}@siptrunk,60)

0
 

Author Comment

by:Muhajreen
ID: 35109912
Thank you for your helpful post ! I was waiting for your response :)

Actually this worked perfectly:

exten => _[1234],1,dial(SIP/${GSM${EXTEN}}@siptrunk,60)

But this didn't work:

exten => h,1,Set(emailDest=${EVAL(Email${EXTEN})})
exten => h,2,System(/usr/local/bin/sendEmail -f me@domain.com -t ${emailDest} -m 'This is a test message' )

In console, I am getting: Set("SIP/gsmgw-00001184", "smsDest=GSMh")

Here are two problems: GSM and h.

Thank you in advance.
0
 

Author Comment

by:Muhajreen
ID: 35109945
Sorry for the mistake, the verbose is:

Set("SIP/gsmgw-00001184", "emailDest=GSMh")
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 35109996
Try this....
If you accept this as part of your solution, please make sure Feptias get's points and best answer.

exten => _[1234],1,dial(SIP/${GSM${EXTEN}}@siptrunk,60)

exten => _[1234],n,Set(numdialed=${EXTEN})

exten => h,1,Set(emailDest=Email${numdialed})
exten => h,2,System(/usr/local/bin/sendEmail -f me@domain.com -t ${emailDest} -m 'This is a test message' )



0
 
LVL 25

Assisted Solution

by:Ron Malmstead
Ron Malmstead earned 200 total points
ID: 35110005
Wait... sorry I meant to reverse the first two lines...

exten => _[1234],1,Set(numdialed=${EXTEN})
exten => _[1234],n,dial(SIP/${GSM${EXTEN}}@siptrunk,60)

exten => h,1,Set(emailDest=Email${numdialed})
exten => h,2,System(/usr/local/bin/sendEmail -f me@domain.com -t ${emailDest} -m 'This is a test message' )

0
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 35110019
Remember that ${EXTEN} always evaluates the current extension....
0
 

Author Closing Comment

by:Muhajreen
ID: 35110184
Thank you both ! Asterisk, EE and you are great !
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question