Asterisk Continue call when use G function

Hi, I’m new and need help about asterisk calling

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.

Use Bridge(). Note that Bridge always continues in the dialplan after the call ends.

many thanks

Can you told how to use Bridge() application. I try but it’s not work.

Please show what you tried, and we can try to see what is wrong. I’m not going to expand on what is in the online documentation, already.

[outgoing-calls]
exten => _0X.,1,Answer()
same => n,Dial(PJSIP/${EXTEN}@myTrunk,10,G(outgoing-calls,Gfunction,1))

exten => Gfunction,1,NoOp()
same => n,Bridge(${CHANNEL})
same => n,(Somecommand)

This not work. I’m not sure that I use Bridge application right format.

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.

Many Thanks,

I just find some command that executed during the calls.

how can I get that or what keyword I need to search.

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.