Newbie - can I do this using Originate command?

I am trying to create a click to call application and will be issuing commands against the manager in .NET. I have everything working to connect a sip extension to an outside number, but what I really want to do is connect two outside numbers.

The scenario is that I will have a web page where visitors can enter their phone number to be connected to an agent. The agent in this case is a realtor so I want to ring that realtors mobile phone. The realtor does not have an extension on the Asterisk box so I need a way to connect the two external numbers in the same way that I can connect an extension to an external number. Can this be done? Right now the channel setting that works looks like “SIP/101” for the originating extension. I tried just putting an external number there and also tried “Local/{externalnumber}”

Thanks for your help

Using local channels should work for this. Make sure when you use local, it goes to a context that has the ability to call out. Something like this:

[realtor-outbound]
exten => _NXXXXXXXXX,1,Dial(SIP/provider/${EXTEN})

Then in the originate you’d do something like this:

Action: Originate
Channel: local/@realtor-outbound
Context: realtor-outbound
Exten:
Priority: 1
Async: True

Thanks! I will give this a try now. I am not good with Asterisk at all and have been using Trixbox so I will have to look into creating the context. I will report back in a few after trying this out.

Thanks,

Vince

I’m sure I am doing something wrong, but I received an error when I tried the suggestion.

I added the context you sent in extensions.conf file…

[realtor-outbound]
exten => _NXXXXXXXXX,1,Dial(SIP/provider/${EXTEN})

Here is the call from my app to the manager.

Debug:[] ManagerConnection:SendToAsterisk - Sent action : ‘44200505_3’ : OriginateAction {Action:Originate; CallerId:mycallerid; Channel:local/404xxxxxx4@realtor-outbound; Context:realtor-outbound; Exten:770xxxxxx9; Priority:1; Async:false; Timeout:15000}

What I get back is that the “Originate Failed”.

What might I be missing?

Thanks!

provider needs to be the name of the sip peer for your SIP provider

Thanks again! That got me past the error, but none of the phones rang.

The message I got back was “Originate successfully queued”.

Here is the debug output

Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: DialEvent {Src:Local/404xxxxxxx@realtor-outbound-1710,1; Destination:SIP/voipstreet-09ce4688; CallerId:; CallerIdName:Asterisk.NET; SrcUniqueId:1231701761.44; DestUniqueId:1231701762.47; DateReceived:2:24:14 PM; Privilege:call,all}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: NewCallerIdEvent {CallerId:770xxxxxxx; CallerIdName:; CidCallingPres:0 (Presentation Allowed, Not Screened); DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701762.47; Channel:SIP/voipstreet-09ce4688}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: NewStateEvent {CallerId:770xxxxxxx; CallerIdName:; State:Up; DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701762.47; Channel:SIP/voipstreet-09ce4688}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: LinkEvent {Channel1:Local/404xxxxxxx@realtor-outbound-1710,1; Channel2:SIP/voipstreet-09ce4688; UniqueId1:1231701761.44; UniqueId2:1231701762.47; CallerId1:(null); CallerId2:770xxxxxxx; DateReceived:2:24:14 PM; Privilege:call,all}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: UnlinkEvent {Channel1:Local/404xxxxxxx@realtor-outbound-1710,2; Channel2:SIP/voipstreet-09cc6c60; UniqueId1:1231701761.45; UniqueId2:1231701761.46; CallerId1:(null); CallerId2:404xxxxxxx; DateReceived:2:24:14 PM; Privilege:call,all}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: HangupEvent {Cause:16; CauseTxt:Normal Clearing; DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701761.46; Channel:SIP/voipstreet-09cc6c60}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: HangupEvent {Cause:16; CauseTxt:Normal Clearing; DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701761.45; Channel:Local/404xxxxxxx@realtor-outbound-1710,2}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: UnlinkEvent {Channel1:Local/404xxxxxxx@realtor-outbound-1710,1; Channel2:SIP/voipstreet-09ce4688; UniqueId1:1231701761.44; UniqueId2:1231701762.47; CallerId1:(null); CallerId2:770xxxxxxx; DateReceived:2:24:14 PM; Privilege:call,all}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: HangupEvent {Cause:16; CauseTxt:Normal Clearing; DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701762.47; Channel:SIP/voipstreet-09ce4688}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: HangupEvent {Cause:16; CauseTxt:Normal Clearing; DateReceived:2:24:14 PM; Privilege:call,all; UniqueId:1231701761.44; Channel:Local/404xxxxxxx@realtor-outbound-1710,1}
Debug:[ManagerReader-37] ManagerConnection:DispatchEvent - Dispatching event: RegistryEvent {Domain:chi-reg.voipstreet.com; Status:Registered; DateReceived:2:24:14 PM; Privilege:system,all; Attributes:[channeldriver:SIP]}

What is the output on the asterisk cli with verbosity turned up and sip debug turned on.

Here is what came back:

CSeq: 103 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Proxy-Authorization: Digest username=“ownersway-9964755”, realm=“asterisk”, algorithm=MD5, uri="sip:7704130869@chi-out.voipstreet.com", nonce=“2be65f18”, response=“18193845f8325f657336584061756c75”, opaque=""
Date: Sun, 11 Jan 2009 23:19:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 262

v=0
o=root 2324 2325 IN IP4 192.168.2.99
s=session
c=IN IP4 192.168.2.99
t=0 0
m=audio 18864 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


trixbox1CLI>
<— SIP read from 64.136.174.24:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK0efd0bc8;received=24.99.50.75;rport=5060
From: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as1f05fefe
To: sip:7704130869@chi-out.voipstreet.com
Call-ID: 1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99
CSeq: 103 INVITE
User-Agent: VoIPStreet
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:7704130869@64.136.174.24
Content-Length: 0
trixbox1
CLI>

<------------->
— (11 headers 0 lines) —
trixbox1*CLI>
<— SIP read from 64.136.174.24:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK0efd0bc8;received=24.99.50.75;rport=5060
From: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as1f05fefe
To: sip:7704130869@chi-out.voipstreet.com;tag=as0c0c00cb
Call-ID: 1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99
CSeq: 103 INVITE
User-Agent: VoIPStreet
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:7704130869@64.136.174.24
Content-Type: application/sdp
Content-Length: 242

v=0
o=root 11170 11170 IN IP4 64.136.174.24
s=session
c=IN IP4 64.136.174.24
t=0 0
m=audio 12618 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------->
— (12 headers 12 lines) —
Found RTP audio format 0
Found RTP audio format 101
Peer audio RTP is at port 64.136.174.24:12618
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0x4 (ulaw)/video=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port 64.136.174.24:12618
list_route: hop: sip:7704130869@64.136.174.24
set_destination: Parsing sip:7704130869@64.136.174.24 for address/port to send to
set_destination: set destination to 64.136.174.24, port 5060
Transmitting (no NAT) to 64.136.174.24:5060:
ACK sip:7704130869@64.136.174.24 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK0f34558e;rport
From: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as1f05fefe
To: sip:7704130869@chi-out.voipstreet.com;tag=as0c0c00cb
Contact: sip:Unknown@192.168.2.99
Call-ID: 1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99
CSeq: 103 ACK
User-Agent: Asterisk PBX
Max-Forwards: 70
Content-Length: 0


-- SIP/voipstreet-09ce4688 answered Local/4047236524@realtor-outbound-01b4,1

trixbox1*CLI>
<— SIP read from 64.136.174.24:5060 —>
BYE sip:Unknown@192.168.2.99 SIP/2.0
Via: SIP/2.0/UDP 64.136.174.24:5060;branch=z9hG4bK37e13c00;rport
From: sip:4047236524@chi-out.voipstreet.com;tag=as1eab01cd
To: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as6f82ad5d
Call-ID: 47441e234de7fe5d03f1c4c47c7bc570@192.168.2.99
CSeq: 102 BYE
User-Agent: VoIPStreet
Max-Forwards: 70
Content-Length: 0

<------------->
— (9 headers 0 lines) —
Sending to 64.136.174.24 : 5060 (NAT)
trixbox1*CLI>
<— Transmitting (NAT) to 64.136.174.24:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 64.136.174.24:5060;branch=z9hG4bK37e13c00;received=64.136.174.24;rport=5060
From: sip:4047236524@chi-out.voipstreet.com;tag=as1eab01cd
To: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as6f82ad5d
Call-ID: 47441e234de7fe5d03f1c4c47c7bc570@192.168.2.99
CSeq: 102 BYE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:Unknown@192.168.2.99
Content-Length: 0

<------------>
== Spawn extension (realtor-outbound, 4047236524, 1) exited non-zero on 'Local/4047236524@realtor-outbound-01b4,2’
Really destroying SIP dialog ‘47441e234de7fe5d03f1c4c47c7bc570@192.168.2.99’ Method: BYE
Reliably Transmitting (NAT) to 192.168.2.4:6880:
OPTIONS sip:101@192.168.2.4:6880;rinstance=bfcd4558d11500be SIP/2.0
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK78c95e36;rport
From: “Unknown” sip:Unknown@192.168.2.99;tag=as6575cb49
To: sip:101@192.168.2.4:6880;rinstance=bfcd4558d11500be
Contact: sip:Unknown@192.168.2.99
Call-ID: 1699daa35677aa2756ae9798734fb5c6@192.168.2.99
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Sun, 11 Jan 2009 23:19:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


Scheduling destruction of SIP dialog ‘1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99’ in 32000 ms (Method: INVITE)
set_destination: Parsing sip:7704130869@64.136.174.24 for address/port to send to
set_destination: set destination to 64.136.174.24, port 5060
Reliably Transmitting (no NAT) to 64.136.174.24:5060:
BYE sip:7704130869@64.136.174.24 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK6a629ddb;rport
From: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as1f05fefe
To: sip:7704130869@chi-out.voipstreet.com;tag=as0c0c00cb
Call-ID: 1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99
CSeq: 104 BYE
User-Agent: Asterisk PBX
Max-Forwards: 70
Proxy-Authorization: Digest username=“ownersway-9964755”, realm=“asterisk”, algorithm=MD5, uri="sip:7704130869@64.136.174.24", nonce=“2be65f18”, response=“554b3bba8342269a4deebad9ec86f3dd”, opaque=""
Content-Length: 0


== Spawn extension (realtor-outbound, 7704130869, 1) exited non-zero on 'Local/4047236524@realtor-outbound-01b4,1’
trixbox1*CLI>
<— SIP read from 64.136.174.24:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK6a629ddb;received=24.99.50.75;rport=5060
From: “Asterisk.NETsip:Unknown@192.168.2.99;tag=as1f05fefe
To: sip:7704130869@chi-out.voipstreet.com;tag=as0c0c00cb
Call-ID: 1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99
CSeq: 104 BYE
User-Agent: VoIPStreet
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: sip:7704130869@64.136.174.24
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Really destroying SIP dialog ‘1398f25c49b9a0fd28a8d5da25766f2a@192.168.2.99’ Method: INVITE
trixbox1*CLI>
<— SIP read from 192.168.2.4:6880 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.99:5060;branch=z9hG4bK78c95e36;rport=5060
Contact: sip:192.168.2.4:6880
To: sip:101@192.168.2.4:6880;rinstance=bfcd4558d11500be;tag=951dd844
From: "Unknown"sip:Unknown@192.168.2.99;tag=as6575cb49
Call-ID: 1699daa35677aa2756ae9798734fb5c6@192.168.2.99
CSeq: 102 OPTIONS
Accept: application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite release 1100l stamp 47546
Content-Length: 0

<------------->
— (12 headers 0 lines) —
Really destroying SIP dialog ‘1699daa35677aa2756ae9798734fb5c6@192.168.2.99’ Method: OPTIONS
trixbox1*CLI>

Hi davevg, thans for the help on this so far. Any other thoughts on the last error I posted? I included the debug output.

I don’t get an error in my script, but the numbers that I have set to dial do not ring.

Thanks!

Unless I’m mistaken, it looks like the calls have answered. Is it possible that the calls are getting an operator intercept on the carrier side? (Do you have available credit with the carrier?) What happens if you call the numbers directly from the server without using the originate command? Also do you need to prepend a 1 for that specific carrier?

Thanks for the reply davevg. There is einough of a balance with the carrier. I can also call to and from those numbers from the server. I am not too sure about the exact dial pattern that the carrier is expecting, but the format for the caller and callee is the same as the format I used when using the originate command with a SIP/ extension as the originator.

Thanks!

daveg, I have verified that I am passing the numbers in the correct format. Any other thoughts? Thanks again for the help!

Send this to your * manager:
Action: Originate
Channel: Zap/g1/realtor#
Context: default
Exten: ext#
Priority: 1
Callerid: 8005551212

In my *, this calls the Zap number and when it answers, the * extension gets connected.

Thanks for the response. I did get some additional help and found a couple issues. I needed to pass a 1 before the numbers being dialed and also there seems to have been an issue with my * box that cleared up after a restart.

Thanks again