<div dir="ltr">Ok, so to answer myself, since on an origination there isn't a- and b-leg, there's no need to export...<div>So this is what works:</div><div><br></div><div> session.execute( "set", "session_in_hangup_hook=true" )<br> session.execute( "set", "api_hangup_hook=python cdr" )<br></div><div><br></div><div><br></div><div>Thanks everyone!<div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 10, 2020 at 9:15 PM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com">david.villasmil.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>So I'm receiving an INVITE that i'm simply use to generate an origination, something like:</div><div><br></div><div><font face="monospace"><extension name="in_out_test"><br> <condition field="destination_number" expression="^(whatever)$"><br> <action application="log" data="ERR Starting lua script..."/><br> <action application="info" data=""/><br> <action application="set" data="hangup_after_bridge=true"/><br> <action application="python" data="foo-outbound"/><br> </condition><br></extension></font><br></div><div><br></div><div>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:</div><div><br></div><div><font face="monospace"># Some headers data gathering, then:</font></div><div><font face="monospace">session.execute( "set", "session_in_hangup_hook=true" )</font></div><div><font face="monospace">session.execute( "export", "nolocal:api_hangup_hook=python cdr" )<br>call_command = '{cldnum=' + CallStruct['to'] + \<br> ',ignore_early_media=true,audio1=' + CallStruct['audios'] + \<br> ',app_campaing_type=' + CallStruct['type'] + \<br> ',originate_retries=' + CallStruct['retry'] + \<br> ',app_phone_desc=' + CallStruct['phone_desc'] + \<br> ',app_gateway=' + CallStruct['gateway'] + \<br> ',originate_timeout=30' + \<br> ',app_from=' + CallStruct['to'] + \<br> ',app_to=' + CallStruct['from'] + \<br> ',origination_callee_id_number=' + CallStruct['to'] + \<br> ',origination_caller_id_number=' + CallStruct['from'] + \<br> '}sofia/gateway/' + CallStruct['gateway'] + '/' + CallStruct['to'] + ' 9999 XML public'</font><br></div><div><br></div><div>But this doesn't seem to be doing anything..</div><div><br></div><div>Anyone ever done this before?</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div>
</blockquote></div>