Going to resort to asterisk -rx as this is a simple call and want to 
temporarily solve the issue rather quickly but I need to find out what the 
escape charecter is for this line as it doesn't work:




$sip_peer = 2342342342
$peer_count = system('asterisk -rx "sip show peer $sip_peer" | grep -c 
"X-Lite"', $retval);


Above is supposed to return 1 if $sip_peer is registered (by utilizing grep 
-count) with X-Lite as word found and 0 if it is not registered but it always 
returns 0, I think because the " " are confusing php.


I searched and since no one probably uses asterisk -rx this way, there are no 
results on google. In addition, php people never use asterisk -rx either....so 
their solutions never include the use of " " inside ' '


What could be the escape charecter for I guess "sip show peer $sip_peer" and 
"X-Lite" part so it returns the proper value back.




Thanks,
Bruce
> Date: Mon, 14 Jun 2010 18:22:06 -0400
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [on-asterisk] How to pass ${EXTEN} from dialplan to php file 
> which accept variable $did_numb ???
> 
> ----- Original Message -----
> > Thanks for the great input again. It was the phpagi path that I had
> > wrong in the .agi file. Once that was set properly everything works
> > fine. Now, I need to find out a way to check status of a registered
> > peer. Wondering if there is a request I can send for that in the
> > phpagi?!
> 
> I think you need to use the Manager API for that. Two ways:
> 
> You could use PHP's system() call to run "asterisk -r ...." and capture and 
> parse the output.
> 
> Or you could get a asterisk manager library for PHP and do it as a function.
> 
> Which you choose depends on how often Asterisk will call the AGI script.
> 
> -- 
> John Van Ostrand 
> CTO, co-CEO 
> Net Direct Inc. 
> 564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
> Ph: 866-883-1172 x5102 
> Fx: 519-883-8533 
> 
> Linux Solutions / IBM Hardware 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
                                          
_________________________________________________________________
Look 'em in the eye: FREE Messenger video chat
http://go.microsoft.com/?linkid=9734386

Reply via email to