I am a beginner in Asterisk and I am trying to operate Asterisk using REST api. I am having an Asterisk server and three SIP agents connected to it with number 9001,9002,9003.
My motive is to make call to 9002 from 9001 using REST api and and call and the play a wav file in 9002 from 9001. All these operation i want to achieve using REST api and curl.
I am able to call from my PC using the below curl command. But when we attend the call in SIP agent its disconnects, it not continuing in the call.
curl -v -u aritest:passme -X POST "http://192.168.43.212:8088/ari/channels?endpoint=SIP/9002&extension=9001&context=from-internal&priority=1&callerId=9001"
It would be in the dialplan, extensions.conf. That is not something Asterisk produces but is configured and defined either by the deployer/administrator or a GUI.
I’ve told you what needs to be changed but haven’t fixed your curl request. This is on purpose because I’m trying to get you to do some investigation, research, and learning on your own. Contexts and dialplan are a fundamental aspect of Asterisk and you need to have the basics of them to be able to use it.
curl -v -u aritest:passme -X POST "http://192.168.43.212:8088/ari/channels?endpoint=SIP/9002&extension=9001&context=default&priority=1&callerId=9001"
still the call holds for 30 seconds, these are the errors i get in log
[Feb 19 18:36:11] WARNING[12671] chan_sip.c: Retransmission timeout reached on transmission 29c88cb873f066885a0935850de36444@192.168.43.212:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
[Feb 19 18:36:23] WARNING[12611] db.c: Error executing SQL (COMMIT): database is locked
[Feb 19 18:36:26] WARNING[12671] chan_sip.c: Retransmission timeout reached on transmission 15e95bce7f1300812f70bc5061f13327@192.168.43.212:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response
[Feb 19 18:36:30] ERROR[12671] netsock2.c: getaddrinfo("(null)", "(null)", ...): Name or service not known
[Feb 19 18:36:30] WARNING[12671] chan_sip.c: Invalid host name in Contact: (can't resolve in DNS) : '(null)'
[Feb 19 18:36:30] ERROR[12671] netsock2.c: getaddrinfo("(null)", "(null)", ...): Name or service not known
[Feb 19 18:36:30] WARNING[12671] chan_sip.c: Can't find address for host '(null)'
[Feb 19 18:36:40] ERROR[12717][C-00000000] netsock2.c: getaddrinfo("(null)", "(null)", ...): Name or service not known
[Feb 19 18:36:40] WARNING[12717][C-00000000] chan_sip.c: Can't find address for host '(null)'
[Feb 19 18:37:02] WARNING[12671] chan_sip.c: Retransmission timeout reached on transmission 453cca0a2891d33e1f6192dd328e6b3b@192.168.43.212:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response
[Feb 19 18:37:30] WARNING[12611] db.c: Error executing SQL (COMMIT): database is locked
It couldn’t send the SIP request to whatever you called. You’ve also got a broken local sqlite database, I don’t know what would have caused it. Your networking also seems problematic.
How to fix the local sql database? If i issue asterisk -cvvvvv and check core show channels command the Asterisk cli shows 0 active calls while an active call is going on between two SIP agents.