I finally gave up calling mod_curl from api_reporting_hook.
It seems the channel variables are always already destroyed when curl is called (not all of them).

I found a solution by running a lua script with api_reporting_hook.
Now, I can access the session variables.
But the script needs to be run by lua command, not luarun.
As my lua script is going to use socket.http to make a HTTP GET request, I wonder if I should expect any side-effects if the HTTP server takes 2 or 3 secondes to answer.

David Ponzone  Direction Technique
tel:      01 74 03 18 97
gsm:   06 66 98 76 34

Service Client IPeva
tel:      0811 46 26 26

Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur.




Le 15 sept. 2016 à 16:42, David Ponzone <david.ponzone@ipeva.fr> a écrit :

api_hangup_hook does not work.
api_reporting_hook is supposed to be the one as you can access channel variables during REPORTING.

David Ponzone  Direction Technique
tel:      01 74 03 18 97
gsm:   06 66 98 76 34

Service Client IPeva
tel:      0811 46 26 26

Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur.




Le 15 sept. 2016 à 15:51, Don Hawkins <hawkins@hawkinsegroup.com> a écrit :

Have you tried execute_on_hangup or api_hangup_hook?

Generally though, the variables tend to be gone after the call hangs up, neither solution worked for me so I just get the info I need from the http post mod_xml_curl sends.

Sincerely,
Don Hawkins

Sent from my NationPCS® Nexus 6.


On Sep 15, 2016 8:38 AM, "David Ponzone" <david.ponzone@ipeva.fr> wrote:
I am trying to run mod_curl after hangup, in order to sens some channel variables to a HTTP server:

    <extension name="from_SIP_account_to_US_TollFree">
       <condition field="destination_number" expression="^00(1800\d+)$">
         <action application="set" data="api_reporting_hook=curl http://server/script.php?orig=${sip_from_user}&dest=${destination_number}&callstart=${answered_time}&callend=${hangup_time} headers get"/>
         <action application="set" data="session_in_hangup_hook=true"/>
         <action application="bridge" data="{sip_cid_type=none}sofia/gateway/trunk.out/+$1"/>
       </condition>
     </extension>

When I hangup, only sip_from_user and destination_number are correct.
answered_time contains 0 and hangup_time is empty

Am I missing something ?

Thank you

David Ponzone  Direction Technique
tel:      01 74 03 18 97
gsm:   06 66 98 76 34

Service Client IPeva
tel:      0811 46 26 26

Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur.





_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org