Exec script at hangup

Hello all,

i need to execute a script at the beginning and at the end of a call with a variable

i try this on my default dialplan :

    <extension name="PSTN">
       <condition field="${sip_h_X-CallType}" expression="^(PSTN)$">
          <action application="log" data="INFO - good Sip Account ID $1 - continue"/>
		  <action application="export" data="SIPAccountID=${sip_h_X-AccountId}"/>
          <condition field="destination_number" expression="^(.+)$">
                  <action application="info"/>
				  <action application="system" data="/usr/share/freeswitch/scripts/call_start.sh ${SIPAccountID}"/>
                  <action application="set" data="outside_call=true"/>
                  <action application="set" data="call_timeout=600"/>
                  <action application="lua" data="myluascript.lua"/>
                  <action application="set" data="sip_h_X-CID=${sip_call_id}"/>
                  <action application="export" data="_nolocal_max_forwards=71"/>
                  <action application="bridge" data="${myscript_bridge}"/>
				  <action application="hangup"/>
				  <action application="system" data="/usr/share/freeswitch/scripts/call_end.sh ${SIPAccountID}"/>
          </condition>
        </condition>
    </extension>

it seems that after bridging it doesn’t do anything anymore.

any idea ?