Problem with send_request() in phpagi


#1

Hi,

I am using Asterisk@home 2.8 I have a problem with send_request() and Originate within phpagi. When I create file “example.call” with this content:

Channel: SIP/123
Context: from-internal-custom
Extension: *60
Priority: 1

…and move it into asterisk/outgoing/ directory directly everything works fine => it will initiate call to 123

extensnsion and say time (default asterisk *60 custom extension). But when I use this code and run it in the browser:

<? require('phpagi.php'); $agi = new AGI(); require_once('phpagi-asmanager.php'); $asm = new AGI_AsteriskManager(); if($asm->connect()) { $call = $asm->send_request('Originate', array('Channel'=>"SIP/123", 'Context'=>'from-internal-custom', 'Extension'=>"*60", 'Priority'=>1, ) ); $asm->disconnect(); } ?>

…it will also initiate call to 123 extension but when I pickup the phone it will hang up with default message “good bye” only. The only suspicious things I have noticed are two lines in the log file:

May 15 16:32:53 VERBOSE[27337] logger.c: == Starting SIP/123-8693 at from-internal-custom,1 failed so falling back to exten 's’
May 15 16:32:53 VERBOSE[27337] logger.c: == Starting SIP/123-8693 at from-internal-custom,s,1 still failed so falling back to context ‘default’

Do you have aby ideas what I am doing wrong, where to look, what to change, etc… I have tried timeout paramter also but it didnot work either…

Thanks in advance…

pavel

ps: asterisk full log output:

May 15 16:32:44 DEBUG[27335] manager.c: Manager received command ‘login’
May 15 16:32:44 VERBOSE[27335] logger.c: == Parsing ‘/etc/asterisk/manager.conf’: May 15 16:32:44 VERBOSE[27335] logger.c: == Parsing ‘/etc/asterisk/manager.conf’: Found
May 15 16:32:44 VERBOSE[27335] logger.c: == Parsing ‘/etc/asterisk/manager_custom.conf’: May 15 16:32:44 VERBOSE[27335] logger.c: == Parsing ‘/etc/asterisk/manager_custom.conf’: Found
May 15 16:32:44 DEBUG[27335] acl.c: 0.0.0.0/0.0.0.0/0.0.0.0 appended to acl for peer
May 15 16:32:44 DEBUG[27335] acl.c: 127.0.0.1/255.255.255.0/255.255.255.0 appended to acl for peer
May 15 16:32:44 DEBUG[27335] acl.c: ##### Testing 127.0.0.1 with 0.0.0.0
May 15 16:32:44 DEBUG[27335] acl.c: ##### Testing 127.0.0.1 with 127.0.0.0
May 15 16:32:44 VERBOSE[27335] logger.c: == Manager ‘phpagi’ logged on from 127.0.0.1
May 15 16:32:44 DEBUG[27335] manager.c: Manager received command ‘Originate’
May 15 16:32:44 DEBUG[27335] chan_sip.c: Setting NAT on RTP to 0
May 15 16:32:44 DEBUG[27335] chan_sip.c: Outgoing Call for 123
May 15 16:32:44 DEBUG[2918] chan_sip.c: (Provisional) Stopping retransmission (but retaining packet) on ‘2f7aa53212f45c5d36b9af6256646d95@192.168.2.17’ Request 102: Found
May 15 16:32:45 DEBUG[2918] chan_sip.c: (Provisional) Stopping retransmission (but retaining packet) on ‘2f7aa53212f45c5d36b9af6256646d95@192.168.2.17’ Request 102: Found
May 15 16:32:53 DEBUG[2918] chan_sip.c: Acked pending invite 102
May 15 16:32:53 DEBUG[2918] chan_sip.c: Stopping retransmission on ‘2f7aa53212f45c5d36b9af6256646d95@192.168.2.17’ of Request 102: Match Found
May 15 16:32:53 DEBUG[2918] chan_sip.c: Oooh, we need to change our formats since our peer supports only 0x8 (alaw) and not 0x4 (ulaw)
May 15 16:32:53 DEBUG[2918] chan_sip.c: build_route: Contact hop:
May 15 16:32:53 DEBUG[27335] manager.c: Manager received command ‘Logoff’
May 15 16:32:53 VERBOSE[27335] logger.c: == Manager ‘phpagi’ logged off from 127.0.0.1
May 15 16:32:53 VERBOSE[27337] logger.c: == Starting SIP/123-8693 at from-internal-custom,1 failed so falling back to exten ‘s’
May 15 16:32:53 VERBOSE[27337] logger.c: == Starting SIP/123-8693 at from-internal-custom,s,1 still failed so falling back to context ‘default’
May 15 16:32:53 VERBOSE[27337] logger.c: – Executing Playback(“SIP/123-8693”, “vm-goodbye”) in new stack
May 15 16:32:53 DEBUG[27337] channel.c: Scheduling timer at 160 sample intervals
May 15 16:32:53 VERBOSE[27337] logger.c: – Playing ‘vm-goodbye’ (language ‘en’)
May 15 16:32:54 DEBUG[27337] channel.c: Scheduling timer at 154 sample intervals
May 15 16:32:54 DEBUG[27337] channel.c: Scheduling timer at 0 sample intervals
May 15 16:32:54 DEBUG[27337] channel.c: Scheduling timer at 0 sample intervals
May 15 16:32:54 VERBOSE[27337] logger.c: – Executing Macro(“SIP/123-8693”, “hangupcall”) in new stack
May 15 16:32:54 VERBOSE[27337] logger.c: – Executing ResetCDR(“SIP/123-8693”, “w”) in new stack
May 15 16:32:54 DEBUG[27337] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record.
May 15 16:32:54 DEBUG[27337] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES (‘2006-05-15 16:32:53’,’’,’’,’’,‘from-internal-custom’, ‘SIP/123-8693’,’’,‘ResetCDR’,‘w’,1,0,‘ANSWERED’,3,’’,‘1147728764.47’)
May 15 16:32:54 VERBOSE[27337] logger.c: – Executing NoCDR(“SIP/123-8693”, “”) in new stack
May 15 16:32:54 WARNING[27337] cdr.c: CDR on channel ‘SIP/123-8693’ not posted
May 15 16:32:54 WARNING[27337] cdr.c: CDR on channel ‘SIP/123-8693’ lacks end
May 15 16:32:54 VERBOSE[27337] logger.c: – Executing Wait(“SIP/123-8693”, “5”) in new stack
May 15 16:32:54 VERBOSE[27337] logger.c: == Spawn extension (macro-hangupcall, s, 3) exited non-zero on ‘SIP/123-8693’ in macro 'hangupcall’
May 15 16:32:54 VERBOSE[27337] logger.c: == Spawn extension (macro-hangupcall, s, 3) exited non-zero on 'SIP/123-8693’
May 15 16:32:54 DEBUG[27337] chan_sip.c: update_call_counter(123) - decrement call limit counter
May 15 16:32:54 DEBUG[27337] chan_sip.c: update_call_counter(123) - decrement call limit counter