Re: [asterisk-users] Connecting two calls with Originate
From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Kathryn Jones Subject: [asterisk-users] Connecting two calls with Originate Hello list!! I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? snip I am not having much luck, am I going about this the wrong way? Thanks in advance for your replies. Assuming that you're not trying to dial back out on the same line, this should not be problematic. The AGI originate is not necessarily aware that it is working in tandem with an existing call. The Channelopendidcall is the wrong way part of this equation. For example, if the call comes in on DAHDI/1-1, you can't use DAHDI/1-1 to open a second call whilst it is active; you can make a call on DAHDI/1-2 and join the 2 together. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Connecting two calls with Originate
Wow, that was fast. Thanks for your reply!!! So if I were to do: Action: login Username: Secret: Events: off Action: Originate Channel: SIP/trunk Context: context-for-second-call Exten: secondCall Priority: 1 Callerid: CallerID Timeout: 30 I could connect the 2 calls? It's my first time using Originate, so be patient with me :) On Mon, Aug 9, 2010 at 10:00 AM, Danny Nicholas da...@debsinc.com wrote: *From:* asterisk-users-boun...@lists.digium.com [mailto: asterisk-users-boun...@lists.digium.com] *On Behalf Of *Kathryn Jones *Subject:* [asterisk-users] Connecting two calls with Originate Hello list!! I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? snip I am not having much luck, am I going about this the wrong way? Thanks in advance for your replies. Assuming that you’re not trying to dial back out on the same line, this should not be problematic. The AGI originate is not necessarily aware that it is working in tandem with an existing call. The “Channelopendidcall” is the “wrong way” part of this equation. For example, if the call comes in on DAHDI/1-1, you can’t use DAHDI/1-1 to open a second call whilst it is active; you can make a call on DAHDI/1-2 and join the 2 together. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Connecting two calls with Originate
From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Kathryn Jones Sent: Monday, August 09, 2010 11:22 AM Subject: Re: [asterisk-users] Connecting two calls with Originate On Mon, Aug 9, 2010 at 10:00 AM, Danny Nicholas da...@debsinc.com wrote: From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Kathryn Jones Subject: [asterisk-users] Connecting two calls with Originate Hello list!! I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? snip I am not having much luck, am I going about this the wrong way? Thanks in advance for your replies. -Assuming that you're not trying to dial back out on the same line, this should not be problematic. The AGI originate is not necessarily aware that it is working in tandem with an existing call. The Channelopendidcall is the wrong way part of this equation. For example, if the call comes in on DAHDI/1-1, you can't use DAHDI/1-1 to open a second call whilst it is active; you can make a call on DAHDI/1-2 and join the 2 together. Wow, that was fast. Thanks for your reply!!! So if I were to do: Action: login Username: Secret: Events: off Action: Originate Channel: SIP/trunk Context: context-for-second-call Exten: secondCall Priority: 1 Callerid: CallerID Timeout: 30 I could connect the 2 calls? As best as I know, yes this should work. You are actually creating a new leg with the originate, but the net effect is a joined call. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Connecting two calls with Originate
I have been working on this for a while today, and still no luck. This is my script: #!/usr/bin/php ?php $errno=0; $errstr=0; $fp = fsockopen (localhost,5038,$errno,$errstr,20); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs($fp, Action: Login\r\n); fputs($fp, Username: \r\n); fputs($fp, Secret: \r\n); fputs($fp, Events: off\r\n); sleep(1); fputs($fp, Action: Originate\r\n); fputs($fp, Channel: SIP/trunk/1DIDNumber\r\n); fputs($fp, Context: CallContext\r\n\r\n); fputs($fp, Exten: NumberToCall\r\n); fputs($fp, Priority: 1\r\n); fputs($fp, Timeout: 3\r\n); sleep(2); fclose($fp); } ? It seems simple enough, And I have no compilation errors. This is my output: -- Launched AGI Script /var/lib/asterisk/agi-bin/MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_request: MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_channel: SIP/xx.xx.xxx.xx-0111 SIP/xx.xx.xxx.xx-0111AGI Tx agi_language: en SIP/xx.xx.xxx.xx-0111AGI Tx agi_type: SIP SIP/xx.xx.xxx.xx-0111AGI Tx agi_uniqueid: 128139.000 SIP/xx.xx.xxx.xx-0111AGI Tx agi_version: 1.6.2.6 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callerid: 1PhoneThatCalled The DID SIP/xx.xx.xxx.xx-0111AGI Tx agi_calleridname: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingpres: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingani2: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callington: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingtns: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_dnid: IncomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_rdnis: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_context: default SIP/xx.xx.xxx.xx-0111AGI Tx agi_extension: incomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_priority: 3 SIP/xx.xx.xxx.xx-0111AGI Tx agi_enhanced: 0.0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_accountcode: SIP/xx.xx.xxx.xx-0111AGI Tx agi_threadid: -123700 SIP/xx.xx.xxx.xx-0111AGI Tx == Manager 'Man' logged on from 127.0.0.1 == Manager 'Man' logged off from 127.0.0.1 SIP/xx.xx.xxx.xx-0111AGI Rx SIP/xx.xx.xxx.xx-0111AGI Tx 510 Invalid or unknown command [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe -- SIP/xx.xx.xxx.xx-0111AGI Script MyScript.php completed, returning 0 Could someone please point me in the right direction? On Mon, Aug 9, 2010 at 11:15 AM, Danny Nicholas da...@debsinc.com wrote: *From:* asterisk-users-boun...@lists.digium.com [mailto: asterisk-users-boun...@lists.digium.com] *On Behalf Of *Kathryn Jones *Sent:* Monday, August 09, 2010 11:22 AM *Subject:* Re: [asterisk-users] Connecting two calls with Originate On Mon, Aug 9, 2010 at 10:00 AM, Danny Nicholas da...@debsinc.com wrote: ***From:* asterisk-users-boun...@lists.digium.com [mailto: asterisk-users-boun...@lists.digium.com] *On Behalf Of *Kathryn Jones *Subject:* [asterisk-users] Connecting two calls with Originate Hello list!! I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? snip I am not having much luck, am I going about this the wrong way? Thanks in advance for your replies. -Assuming that you’re not trying to dial back out on the same line, this should not be problematic. The AGI originate is not necessarily aware that it is working in tandem with an existing call. The “Channelopendidcall” is the “wrong way” part of this equation. For example, if the call comes in on DAHDI/1-1, you can’t use DAHDI/1-1 to open a second call whilst it is active; you can make a call on DAHDI/1-2 and join the 2 together. Wow, that was fast. Thanks for your reply!!! So if I were to do: Action: login Username: Secret: Events: off Action: Originate Channel: SIP/trunk Context: context-for-second-call Exten: secondCall Priority: 1 Callerid: CallerID Timeout: 30 I could connect the 2 calls? As best as I know, yes this should work. You are actually creating a “new leg” with the originate, but the net effect is a joined call. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs
Re: [asterisk-users] Connecting two calls with Originate
On Mon, 9 Aug 2010, Kathryn Jones wrote: I have been working on this for a while today, and still no luck. This is my script: #!/usr/bin/php ?php $errno=0; $errstr=0; $fp = fsockopen (localhost,5038,$errno,$errstr,20); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs($fp, Action: Login\r\n); fputs($fp, Username: \r\n); fputs($fp, Secret: \r\n); fputs($fp, Events: off\r\n); sleep(1); fputs($fp, Action: Originate\r\n); fputs($fp, Channel: SIP/trunk/1DIDNumber\r\n); fputs($fp, Context: CallContext\r\n\r\n); fputs($fp, Exten: NumberToCall\r\n); fputs($fp, Priority: 1\r\n); fputs($fp, Timeout: 3\r\n); sleep(2); fclose($fp); } ? It seems simple enough, And I have no compilation errors. This is my output: -- Launched AGI Script /var/lib/asterisk/agi-bin/MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_request: MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_channel: SIP/xx.xx.xxx.xx-0111 SIP/xx.xx.xxx.xx-0111AGI Tx agi_language: en SIP/xx.xx.xxx.xx-0111AGI Tx agi_type: SIP SIP/xx.xx.xxx.xx-0111AGI Tx agi_uniqueid: 128139.000 SIP/xx.xx.xxx.xx-0111AGI Tx agi_version: 1.6.2.6 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callerid: 1PhoneThatCalled The DID SIP/xx.xx.xxx.xx-0111AGI Tx agi_calleridname: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingpres: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingani2: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callington: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingtns: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_dnid: IncomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_rdnis: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_context: default SIP/xx.xx.xxx.xx-0111AGI Tx agi_extension: incomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_priority: 3 SIP/xx.xx.xxx.xx-0111AGI Tx agi_enhanced: 0.0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_accountcode: SIP/xx.xx.xxx.xx-0111AGI Tx agi_threadid: -123700 SIP/xx.xx.xxx.xx-0111AGI Tx == Manager 'Man' logged on from 127.0.0.1 == Manager 'Man' logged off from 127.0.0.1 SIP/xx.xx.xxx.xx-0111AGI Rx SIP/xx.xx.xxx.xx-0111AGI Tx 510 Invalid or unknown command [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe -- SIP/xx.xx.xxx.xx-0111AGI Script MyScript.php completed, returning 0 Could someone please point me in the right direction? This is not an AGI, this is an AMI :) AGI is a protocol where Asterisk creates a process and sends it the AGI environment (all the AGI Tx agi_xxx cruft above) and then waits for your process to issue requests and read responses. This request, response is repeated as your process completes it's tasks and exits. Are you expecting your script to execute within the context of a channel within Asterisk or as a process external to Asterisk? I read your original request: I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? as I call in, I execute an AGI that looks up an extension based on some criteria, I want to dial that extension. If this is close, the AGI should set a channel variable with the value of the extension and exit. Your dialplan would look something like: exten = my-did,1, verbose(${ext...@${context}) exten = my-did,n, agi(lookup-extension) exten = my-did,n, dial{${LOOKED-UP-EXTENSION}) exten = my-did,n, hangup() -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000-- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Connecting two calls with Originate
-Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards Sent: Monday, August 09, 2010 7:13 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Connecting two calls with Originate On Mon, 9 Aug 2010, Kathryn Jones wrote: I have been working on this for a while today, and still no luck. This is my script: #!/usr/bin/php ?php $errno=0; $errstr=0; $fp = fsockopen (localhost,5038,$errno,$errstr,20); if (!$fp) { echo $errstr ($errno)br\n; } else { fputs($fp, Action: Login\r\n); fputs($fp, Username: \r\n); fputs($fp, Secret: \r\n); fputs($fp, Events: off\r\n); sleep(1); fputs($fp, Action: Originate\r\n); fputs($fp, Channel: SIP/trunk/1DIDNumber\r\n); fputs($fp, Context: CallContext\r\n\r\n); fputs($fp, Exten: NumberToCall\r\n); fputs($fp, Priority: 1\r\n); fputs($fp, Timeout: 3\r\n); sleep(2); fclose($fp); } ? It seems simple enough, And I have no compilation errors. This is my output: -- Launched AGI Script /var/lib/asterisk/agi-bin/MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_request: MyScript.php SIP/xx.xx.xxx.xx-0111AGI Tx agi_channel: SIP/xx.xx.xxx.xx-0111 SIP/xx.xx.xxx.xx-0111AGI Tx agi_language: en SIP/xx.xx.xxx.xx-0111AGI Tx agi_type: SIP SIP/xx.xx.xxx.xx-0111AGI Tx agi_uniqueid: 128139.000 SIP/xx.xx.xxx.xx-0111AGI Tx agi_version: 1.6.2.6 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callerid: 1PhoneThatCalled The DID SIP/xx.xx.xxx.xx-0111AGI Tx agi_calleridname: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingpres: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingani2: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callington: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_callingtns: 0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_dnid: IncomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_rdnis: unknown SIP/xx.xx.xxx.xx-0111AGI Tx agi_context: default SIP/xx.xx.xxx.xx-0111AGI Tx agi_extension: incomingExt SIP/xx.xx.xxx.xx-0111AGI Tx agi_priority: 3 SIP/xx.xx.xxx.xx-0111AGI Tx agi_enhanced: 0.0 SIP/xx.xx.xxx.xx-0111AGI Tx agi_accountcode: SIP/xx.xx.xxx.xx-0111AGI Tx agi_threadid: -123700 SIP/xx.xx.xxx.xx-0111AGI Tx == Manager 'Man' logged on from 127.0.0.1 == Manager 'Man' logged off from 127.0.0.1 SIP/xx.xx.xxx.xx-0111AGI Rx SIP/xx.xx.xxx.xx-0111AGI Tx 510 Invalid or unknown command [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe [Aug 9 17:44:10] ERROR[25594]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe -- SIP/xx.xx.xxx.xx-0111AGI Script MyScript.php completed, returning 0 Could someone please point me in the right direction? This is not an AGI, this is an AMI :) AGI is a protocol where Asterisk creates a process and sends it the AGI environment (all the AGI Tx agi_xxx cruft above) and then waits for your process to issue requests and read responses. This request, response is repeated as your process completes it's tasks and exits. Are you expecting your script to execute within the context of a channel within Asterisk or as a process external to Asterisk? I read your original request: I want to connect an open call with an extension. I call in with a DID, them redirect to the extension using AGI. Can I use agi's originate to make the second call without dropping the first DID call? How would I go about this? as I call in, I execute an AGI that looks up an extension based on some criteria, I want to dial that extension. If this is close, the AGI should set a channel variable with the value of the extension and exit. Your dialplan would look something like: exten = my-did,1, verbose(${ext...@${context}) exten = my-did,n, agi(lookup-extension) exten = my-did,n, dial{${LOOKED-UP-EXTENSION}) exten = my-did,n, hangup() /snip If you are doing what Steve has described, and you require php, you should really check out PHPAGI (http://phpagi.sourceforge.net/). It's a great framework for using both AGI and the AMI in PHP. If you need just the AGI component and are going to be doing this on a large scale, google cagi (http://sourceforge.net/projects/cagi/). It is structured similarly to PHPAGI. -- Elliot Otchet Calling Circles LLC This message is intended only for the use of the individual (s) or entity to which it is addressed and may contain information that is privileged, confidential, and/or proprietary to Calling Circles LLC and its affiliates. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, forwarding or copying of this communication