How can i connect 2 phone calls? Please help

Hi, everyone, and thanks to read this thread.

I am using .call files to generate and connect two callers.

Channel: SIP/test/90624925
MaxRetries: 2
RetryTime: 5
WaitTime: 35
Archive: Yes
Context: default
CallerID: 90624925
Extension: 97454114
Set: file1=5729
Account: 5729
Priority: 1

This isn’t working the way i want it to, because the second call should be Dial, ONLY if the first call is ANSWERED and one more thing (not very important) is that i would like to invoke a PHP AGI once the first call change status (ANSWERED, BUSY, etc…)
When the status is ANSWERED isn’t a problem because it goes to the context (default) the generates the second call. But the other status is something i would like to be able to manage.

Thank you very much in advance for your help, from Honduras.

First issues doesn’t exist. The extension is only called when the channel answers.

For the second problem, you need to use a local channel on the channel side.

[quote=“david55”]First issues doesn’t exist. The extension is only called when the channel answers.

For the second problem, you need to use a local channel on the channel side.[/quote]

Thank you very much for your quick response,
Note. both calls are meant to call cell phone numbers, just to give more information
First: what your wrote is right, or at least i thought it was, but i did some test, and. If the called phone is busy the second call is always generated or if the call reach the answer machine (voice message) (i fix this, reducing the ring time.)

and the second part, i dont understand what you mean, do you have some sort of example? or point me in the right direction to start searching? Thank you, Thank you very much for your quick response. Thanks from Honduras.

Are you sure that the network is not answering and then presenting a call progress signal?

Local/9123456789@outgoing

Hi, and thank you to keep trying helping me.

First i forgot to mentioned that i kind the new in Asterik.

I have no idea about what your writing, i am going to show you the cli results

1 this is what happened when the called phone (call 1) reject the call

-- Attempting call on SIP/wport3/3033903528 for 3199608834@defaulta:1 (Retry 1)

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
> Channel SIP/wport3-00000019 was answered.

– Executing [3199608834@defaulta:1] Verbose(“SIP/wport3-00000019”, "The current channel1 is ") in new stack
The current channel1 is
– Executing [3199608834@defaulta:2] Hangup(“SIP/wport3-00000019”, “”) in new stack
== Spawn extension (defaulta, 3199608834, 2) exited non-zero on ‘SIP/wport3-00000019’

As you can see, even though the call one isn’t really answered (bold part) the system says it was, so the process continues trying to reach the next Dial plan lines to make the second call (underline part).

That problem is arising outside of Asterisk.

If you don’t understand the basic concepts, you need to do more background reading.

[quote=“david55”]That problem is arising outside of Asterisk.

If you don’t understand the basic concepts, you need to do more background reading.[/quote]

Hi, thanks for your answer, i will appreciate if you tell me in which way should i be focusing on.

or tell me if there is another way to accomplished what i need. Thanks a lot from Honduras

You need to talk to your SIP service provider and ask them why they are sending 200 OK before the call has been answered.

The answer might well be that the Honduras PSTN operator doesn’t offer any form of answer supervision that they can use. However, normally you would expect such SIP service provider to use ISDN access to the PSTN.

[quote=“david55”]You need to talk to your SIP service provider and ask them why they are sending 200 OK before the call has been answered.

The answer might well be that the Honduras PSTN operator doesn’t offer any form of answer supervision that they can use. However, normally you would expect such SIP service provider to use ISDN access to the PSTN.[/quote]

Hi, thank you very much for taking your time to post.

First im using a GSM gateway (DINSTAR DWG8) to achive this. And this is the configuration i have

outgoing settings

host=dynamic
username=wport1
secret=wport1
type=peer
qualify=yes
context=from-pstn
canreinvite=no

i dont have any incoming settings. (I wont be using the gateway to receive calls, jut to make them)

and this is an example of the text file Im using:

Channel: SIP/wport1/0013057352203
MaxRetries: 1
RetryTime: 5
WaitTime: 30
Archive: Yes
Context: default
CallerID: 3057352203
Extension: 3033903528
Set: file1=5730
Account: 5730
Priority: 1

and this is the context:
[default]
exten => _XXXXXXXXXX,1,Set(CHANNEL(language)=es)
exten => _XXXXXXXXXX,n,Playback(estaEnProceso)
exten => _XXXXXXXXXX,n,Answer
exten => _XXXXXXXXXX,n,AGI(paqueteria.php,${file1})
exten => _XXXXXXXXXX,n,Dial(SIP/${wport}/${EXTEN},300,L(${Tiempo}:10000)tgh)
exten => _XXXXXXXXXX,n,Hangup

the thing is that, the call should not reach this context, unless the call 1 has been answered.

Thanks a lot.

I do this with this in extensions.conf

187 [clickdial]
188 exten => s,1,Set(TIMEOUT(digit)=5)
189 exten => s,2,Set(TIMEOUT(response)=10)
190 exten => s,3,Answer
191 exten => s,n,Playback(voicemail/placing)
192 exten => s,n,MixMonitor(/usr/share/asterisk/sounds/customer/${FILENAME}.wav,,/usr/bin/lame --preset standard /usr/share/asterisk/sounds/customer/${FILENAME}.wav /usr/share/silverhawk/outbound/${FILENAME}.mp3)
193 exten => s,n,Dial(SIP/${OUTLINE}/${CUSTOMER})

and a callfile that looks like this

Channel: SIP/Packet8-04/13211234567
Extension: s
Context: clickdial
SetVar: OUTLINE=Packet8-04
SetVar: CUSTOMER=1321456789
SetVar: FILENAME=2012_03_30_1158_22_jason_321123456

This setup will play a “connecting your call now” message once the first party picks up, record the call, and archive it as an mp3.