API Nummernabfrage

Hi all,

It’s possible to do that using asterisk AGI. I wrote one small dial plan script which calls AGI.


#perform search only if name is not set
exten => s,1,GotoIf($ "${CALLERID(name)}" != "" ] ?skip)
#you can use CALLERID(num) instead of MDC_CALLER_NUM_INTERNAT if you dont want full number
#invoke AGI 
same => n,AGI(agi_your_script.php,${MDC_CALLER_NUM_INTERNAT})
#check execution result
same => n,GoToIf($ "${AGISTATUS}" = "FAILURE" ]?s-failed,1)
#AGI php script should set variable HTTP_CALLER_ID if matching result is found
same => n,ExecIf($ "${HTTP_CALLER_ID}" != "" ]?Verbose(1,"${HTTP_CALLER_ID}")
same => n,ExecIf($ "${HTTP_CALLER_ID}" != "" ]?Set(CALLERID(name)=${HTTP_CALLER_ID}))
same => n,Return()
same => n(skip),Return()

You should put your custom script agi_your_script.php in /etc/asterisk/agi with proper owner and privileges. Script should invoke any REST API and put result back in variable HTTP_CALLER_ID


SET VARIABLE HTTP_CALLER_ID "pascom Netzwerktechnik"


If you need a help in writing the php script you can contact our Support team. Also you can share your work with others here. I would like to see your result there and I would be pleased to contribute in writing the script.

Kind regards,
Stefan