[Freeswitch-users] hangup_hook on an originated leg

David Villasmil david.villasmil.work at gmail.com
Fri Apr 10 20:29:31 UTC 2020


Ok, so to answer myself, since on an origination there isn't a- and b-leg,
there's no need to export...
So this is what works:

    session.execute( "set", "session_in_hangup_hook=true" )
    session.execute( "set", "api_hangup_hook=python cdr" )


Thanks everyone!

David Villasmil
email: david.villasmil.work at gmail.com
phone: +34669448337


On Fri, Apr 10, 2020 at 9:15 PM David Villasmil <
david.villasmil.work at gmail.com> wrote:

> Hello,
>
> So I'm receiving an INVITE that i'm simply use to generate an origination,
> something like:
>
> <extension name="in_out_test">
>     <condition field="destination_number" expression="^(whatever)$">
>             <action application="log" data="ERR Starting lua script..."/>
>             <action application="info" data=""/>
>             <action application="set" data="hangup_after_bridge=true"/>
>             <action application="python" data="foo-outbound"/>
>     </condition>
> </extension>
>
> With that in a python script in which i need to set a hangup_hook (I need
> the originated variables like billsec, etc) like this:
>
> # Some headers data gathering, then:
> session.execute( "set", "session_in_hangup_hook=true" )
> session.execute( "export", "nolocal:api_hangup_hook=python cdr" )
> call_command = '{cldnum=' + CallStruct['to'] + \
>     ',ignore_early_media=true,audio1=' + CallStruct['audios'] + \
>     ',app_campaing_type=' + CallStruct['type'] + \
>     ',originate_retries=' + CallStruct['retry'] + \
>     ',app_phone_desc=' + CallStruct['phone_desc'] + \
>     ',app_gateway=' + CallStruct['gateway'] + \
>     ',originate_timeout=30' + \
>     ',app_from=' + CallStruct['to'] + \
>     ',app_to=' + CallStruct['from'] + \
>     ',origination_callee_id_number=' + CallStruct['to'] + \
>     ',origination_caller_id_number=' + CallStruct['from'] + \
>     '}sofia/gateway/' + CallStruct['gateway'] + '/' + CallStruct['to'] + '
> 9999 XML public'
>
> But this doesn't seem to be doing anything..
>
> Anyone ever done this before?
>
> Regards,
>
> David Villasmil
> email: david.villasmil.work at gmail.com
> phone: +34669448337
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20200410/790febb6/attachment.html>


More information about the FreeSWITCH-users mailing list