Asterisk Queue and URL executing

Dear All

I want to integrate sugarcrm and asterisk , so when customer call the call center the agent or extension which answers the call , before pickup the phone and talk to customer , view his/her information if it is available.

I do this as described below :
1-Setup login username for sugarcrm for each extension
2-Extension Users will login to the sugarcrm.
3-Develop php script to handle new call ( this script will execute from asterisk )
4-The path to the script is like this :
sugarcrmIP/popup.php?number=CALL … ension=EXT

i.e. consider the extension number is 105 and the callerid is 7891234.

so these numbers will replace the CALLERID and EXT as follows


5-In asterisk in extensions.conf File I have edited the Macro named std-exten ( [macro-stdexten] )

Just before Dial I put the following :

; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring

exten => s,1,Gotoif($[{LEN(${CALLERID(num)})} > 3]?3)
exten => s,2,Goto(s,4)
exten => s,3,TrySystem(wget -qb -O /dev/null -o /dev/null “http://sugarcrmIP/popup.php?number=${CALLERID(num)}&extension=${ARG1}”)
exten => s,4,Dial(${ARG2},35,rt) ; Ring the interface, 20 seconds maximum
exten => s,5,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
;exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
;exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => s-BUSY,1,Playtones(busy)
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain

so when calls come in to asterisk before execute the dial in the macro it will execute the
TrySystem(wget -qb -O /dev/null -o /dev/null “http://sugarcrmIP/popup.php?number=${CALLERID(num)}&extension=${ARG1}”)
and replace ${CALLERID(num)} with the callerid of customer and ${ARG1} with user extension

as I stated in step 4 as an example the following will execute

TrySystem(wget -qb -O /dev/null -o /dev/null “http://sugarcrmIP/popup.php?number=7891234&extension=105”)

and this will cause a screen popup on the user screen which is logged in the sugarcrm and his/her extension number is 105.

Everything work fine with this implementation but when it comes to Queue it fails , cause in the Queue the [macro-stdexten] will not be executed for dialing.

I have a Queue ( huntgroup ) which all the extensions are its member and with random algorithm the calls will be distributed to extensions.
I need the popup but don’t know how to execute the URL with the replacement of the ${CALLERID(num)} and ${ARG1} with value.

Please someone help me.

Best Regards,