In extension I use G function to execute some command when destination receive the call
but when It go to execute some command it hang up the call, I need to continue the call how can I do
extensions.conf
[outgoing-calls]
exten => _0X.,1,Answer()
same => n,Dial(PJSIP/${EXTEN}@myTrunk,10,G(outgoing-calls,Gfunction,1))
exten => Gfunction,1,(Somecommand)
same => n,(Somecommand)
I need to do some command then go back to continue the call.
You cannot bridge to yourself. That make no sense. You should bridge to the other channel. Some channel variables are set by the Dial application, and you can also copy CHANNEL into an inheritable variable before calling Dial.
Only one party should be invoking Bridge. The other party should typically end up a on a Wait.
Somecommand will not be executed until the call ends, and, I think will only be run for the party that actually executed Bridge (which is indeterminate because of the second point. I doubt that you want to only run it at the end, as the normal use of g or h would be sufficient for that.
Without knowing what Somecommend is, it is difficult to know whether there is a better way of achieving your goals.
If you want to run something in parallel with the call, that is closely coupled to the call, you cannot do that with dialplan; you will have to fork a new process which can only be done with the programming languages using the APIs.
A much clearer explanation of your real goals is likely to help produce better answers, although I think you are going to have to do a lot of background reading.
Note that:
didn’t make sense to me and I am guessing as to what you really mean. However it sound likely that you are trying to do something that is not well suited to Asterisk.