14174

How to get the phone number(callerID) in asterisk

Question:

We've been using VICIDIAL for the past 4 years and we're updating our asterisk now. Can you please assist me on the below query?

Once the call has been reached to our IVR, we need to pass the Mobile number to our script whether it exists in our database or not. If it exists it will go one campaign, else it will go to another campaign. We've created the php script and it's working fine but I'm not sure how to <strong>transfer my phone number from asterisk to the php script</strong>?

I've pasted the sample script which I'm planning to use. Can you please have a look on this?

exten => s,n,NoOp("Caller ID IS: ${CALLERID(number)}") exten => s,n,Set(foo=${CURL(http://server.test.com/appln/test.php?data='${CALLERID(number)}')})

Answer1:

Please check this link:

<a href="http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/IVR_id246940.html" rel="nofollow">http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/IVR_id246940.html</a>

Following code is working for me:

exten => s,n,NoOp(Caller ID IS: ${CALLERID(num)}) exten => s,n,Set(foo=${CURL(http://server.test.com/appln/test.php?data=${CALLERID(num)})}) exten => s,n,NoOp(${foo})

Recommend

  • Asterisk : originate call doesn't set the CALLERID in the dialplan
  • Implementing module pattern in Javascript with dependency on jquery
  • Issues replacing Log4j with LogBack, log4j-over-slf4j.jar shortcomings
  • MVC4 validation does not work
  • Does using Foreign Key speed up table joins
  • Sending and Receiving SMS [closed]
  • Cassandra indexes vs materialized view
  • Can I commit a file with git, but automatically ignore it when doing a git svn dcommit?
  • How to pause a python script running in terminal
  • Help with one step build all projects + installer (.NET + WiX)
  • Replicating and differentiating portions of a form
  • Submission of new app with iAds
  • Reading a file into a multidimensional array
  • Android application: how to use the camera and grab the image bytes?
  • Not able to aggregate on nested fields in elasticsearch
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Groovy: Unexpected token “:”
  • How to create a file in java without a extension
  • How to clear text inside text field when radio button is select
  • Scrapy recursive link crawler
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Incrementing object id automatically JS constructor (static method and variable)
  • How to extract text from Word files using C#?
  • How to check if every primary key value is being referenced as foreign key in another table
  • Sending data from AppleScript to FileMaker records
  • MySQL WHERE-condition in procedure ignored
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • How can I estimate amount of memory left with calling System.gc()?
  • Matrix multiplication with MKL
  • A cron job substitute?
  • json Serialization in asp
  • Free memory of cv::Mat loaded using FileStorage API
  • Hits per day in Google Big Query
  • File not found error Google Drive API
  • unknown Exception android
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • Converting MP3 duration time