Problem with dialing

May 6, 2014 at 9:50 AM
Dear moderator,

First of all i want to apologize for my poor English.
We want to create a small application for dialing our customers.
When we click on a phone number the phone which is next to the computer will start dialing the number we have clicked on it.
Below i post my code and the configuration of the asterisk system we have.

In this example the phone extension was 301

code:

private void MakeCall()
    {
        OriginateAction o = new OriginateAction();

        o.Channel = "SIP/trunk-nexiva/" + "99694191";            
        o.Context = "default";
        o.Exten = "301";
        o.CallerId = "3125551212";
        o.Priority = 1;
        o.Timeout = 30000;

        string address = this.tbAddress.Text;
        int port = int.Parse(this.tbPort.Text);
        string user = this.tbUser.Text;
        string password = this.tbPassword.Text;

        manager = new ManagerConnection(address, port, user, password);

        manager.UnhandledEvent += new ManagerEventHandler(manager_Events);

        try
        {
            manager.Login();

            ManagerResponse response = manager.SendAction(o);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error connect\n" + ex.Message);
           // manager.Logoff();
           // this.Close();
        }
    }
extension.conf

[general]
static = yes
writeprotect = no
autofallthrough = yes
clearglobalvars = yes
priorityjumping = no
extenpatternmatchnew = no
[globals]
TOUCH_MONITOR_FORMAT = wav_alaw
TOUCH_MIXMONITOR_FORMAT = wav_alaw
DIALOPTIONS = tTkKWwXx
PRESS5TOLEVMSG_ENABLE = 0
ABSOLUTE_TIMEOUT = 0
RINGTIME = 30
TRANSFER_INCOMING_CALLERID =

BIZHOURS_ENABLE=0

trunk-nexiva = SIP/trunk-nexiva
CID_trunk-nexiva = 546093546

DIALPARAM_OF_EXTEN300=SIP/300
DIALPARAM_OF_EXTEN301=SIP/301
DIALPARAM_OF_EXTEN302=SIP/302
DIALPARAM_OF_EXTEN303=SIP/303
DIALPARAM_OF_EXTEN304=SIP/304
DIALPARAM_OF_EXTEN305=SIP/305
DIALPARAM_OF_EXTEN310=SIP/310

[Local_Default_CallingRules]
include = set-cf-default
include = en-always-cf
include = dis-always-cf
include = en-busy-cf
include = dis-busy-cf
include = en-noanswer-cf
include = dis-noanswer-cf
include = set-cf-number
include = set-cf-vm
  • extensions.conf 1/742 0%
    exten = vm-u,n,Playback(vm-leavemsg)
    exten = vm-u,n,Read(digito,,1,,,3)
    exten = vm-u,n,GotoIf($[${digito}=5]?vm-s,1)
    exten = vm-u,n,Hangup()
    exten = follow-me-busy,1,GotoIf(${DB(CFD/${REALARG1})}>0?vm-b,1)
    exten = follow-me-busy,2,Set(cfnum=${DB(CF/${REALARG1})})
    exten = follow-me-busy,3,GotoIf($[${LEN(${cfnum})}<1]?vm-b,1)
    exten = follow-me-busy,4,GotoIf($["${cfnum}" = "${REALARG1}"]?vm-b,1)
    exten = follow-me-busy,5,Set(IsFollowme=${IF($[${IsFromOutside} = 1]?1:0)})
    exten = follow-me-busy,6,Followme(${REALARG1},n)
    exten = follow-me-busy,7,Goto(vm-b,1)
    exten = vm-b,1,GotoIf($[${PRESS5TOLEVMSG_ENABLE} = 1]?vm-b,2:vm-busy,1)
    exten = vm-b,n,playback(/var/spool/asterisk/voicemail/default/${REALARG1}/busy)
    exten = vm-b,n,Playback(vm-leavemsg)
    exten = vm-b,n,Read(digito,,1,,,3)
    exten = vm-b,n,GotoIf($[${digito}=5]?vm-s,1)
    exten = vm-b,n,playback(/var/spool/asterisk/voicemail/default/${REALARG1}/busy)
    exten = vm-b,n,Playback(vm-leavemsg)
    exten = vm-b,n,Read(digito,,1,,,4)
    exten = vm-b,n,GotoIf($[${digito}=5]?vm-s,1)
    exten = vm-b,n,playback(/var/spool/asterisk/voicemail/default/${REALARG1}/busy)
    exten = vm-b,n,Playback(vm-leavemsg)
    exten = vm-b,n,Read(digito,,1,,,3)
    exten = vm-b,n,GotoIf($[${digito}=5]?vm-s,1)
    exten = vm-b,n,Hangup()
    exten = vm-unavail,1,Voicemail(${REALARG1},u)
    exten = vm-unavail,n,Hangup()
    exten = vm-busy,1,Voicemail(${REALARG1},b)
    exten = vm-busy,n,Hangup()
    exten = vm-s,1,Voicemail(${REALARG1},s)
    exten = vm-s,n,Hangup()
    exten = 1-out,1,Hangup()
    [macro-trunkdial-failover-0.3]
    exten = s,1,NOOP(do call out)
    exten = s,2,GotoIf(${DB_EXISTS(oblacklist/${ARG3})}?Blacklist-Handle,s,1)
    exten = s,3,Gotoif($[${LEN(${FromSystemAlert})}>0]?6:4)})
    exten = s,4,Gotoif($[${LEN(${ARG$[${ARG1}+4]})}>0]?5:6)
    exten = s,5,Authenticate(${ARG$[${ARG1}+4]})
    exten = s,6,Set(TCOUNT=4)
The peers/regisrty of the system

MyPBXCLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
sbc.voipdnsservers.com:5060 N 546093546@sb 61 Registered Mon, 05 May 2014 15:57:03
1 SIP registrations.

MyPBX
CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
300/300 192.168.37.102 D N A 5062 OK (27 ms)
301/301 192.168.37.103 D N A 5062 OK (98 ms)
302/302 192.168.37.115 D N A 5062 OK (20 ms)
303/303 192.168.37.101 D N A 5062 OK (19 ms)
304/304 192.168.37.105 D A 5062 OK (21 ms)
305/305 (Unspecified) D 5060 UNKNOWN
310/310 (Unspecified) D 5060 UNKNOWN
trunk-nexiva/546093546 208.73.146.95 N 5060 OK (210 ms)
8 sip peers [Monitored: 6 online, 2 offline Unmonitored: 0 online, 0 offline]

[2014-05-05 15:57:56] NOTICE[1791]: utils.c:305 HostPoolUpdater: ======host:301-00000005 update dns======

[2014-05-05 15:58:03] NOTICE[1854]: chan_sip.c:27650 ys_chk_all_registers: username:546093546@sbc.voipdnsservers.com register
   > doing dnsmgr_lookup for 'sbc.voipdnsservers.com'
MyPBX*CLI>

The answer i get when i try to dial

Asterisk 1.6.2.6, Copyright (C) 1999 - 2010 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under

certain conditions. Type 'core show license' for details.

== Parsing '/etc/asterisk/asterisk.conf': == Found
Setting max files open to 2048
== Parsing '/etc/asterisk/extconfig.conf': == Found
Connected to Asterisk 1.6.2.6 currently running on MyPBX (pid = 1785)
No entry for terminal type "xterm";
using dumb terminal settings.
Verbosity was 53 and is now 178

[2014-05-05 15:41:56] NOTICE[1791]: utils.c:305 HostPoolUpdater: ======host:301-00000005 update dns======

== Manager 'admin' logged on from 192.168.37.118

== Using SIP RTP TOS bits 184

== Using SIP RTP CoS mark 5
   > Channel SIP/trunk-nexiva-0000000d was never answered.
== Manager 'admin' logged off from 192.168.37.118

[2014-05-05 15:42:11] NOTICE[1854]: chan_sip.c:27650 ys_chk_all_registers: username:546093546@sbc.voipdnsservers.com register
   > doing dnsmgr_lookup for 'sbc.voipdnsservers.com'
MyPBX*CLI>

i will appreciate any help from anybody.

Thanks in advance,
Efthymios
May 6, 2014 at 10:23 AM
Hi, firstly, simply in terms of readability it may be better in future to post long sections of config or output into pastebin (google pastebin). That way formatting wont become an issue either.

Ok, in Originate works by starting a new channel, and once that channel has answered, connecting it to the dialplan. So, you example would call the channel: "SIP/trunk-nexiva/99694191" and then connect it to the extension: 301 in context default. However, I don't see a default context in your extensions.conf. This may be due to formatting though! Worth checking first though.

Does the channel ever get answered? Is the number you are calling something you can answer (your landline/mobile etc)?

A quick google indicates the "Channel was never answered" issue may be to do with the outbound call you are making. Does this call actually happen? It seems that maybe something is wrong with the peer you are calling out via? Can you make that channel work if you simply add it to your dialplan and call it?

Either way, this looks to be an Asterisk issue and not an AsterNET one. For better help you might want to try the Asterisk mailing list or #asterisk on irc.freenode.net

Hope that helps?
May 6, 2014 at 1:30 PM
Hi skrusty,

Dear strusty,

First of all i want to thank you for your reply.

The 99694191 it’s a valid mobile number.
I forgot to meantion that the configuration of the asterisk system can call only US numbers.
When I call my mobile number from the extension I hear a message all-busy-now-try-call-later.

In my program if I put a US number I have the same result. "Channel was never answered"

Do you know where I can find a book or something that it’s easy to read and understand the basics of the asterisk system
I think I have to understand better the meaning of the peers, default context etc…


Below you will find the result of the call from the phone extension 301 it may give you an idea of what happen
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5

== Extension Changed 301[extensions-hintcontext] new state InUse for Notify User 304
== Extension Changed 301[extensions-hintcontext] new state InUse for Notify User 300
== Extension Changed 301[extensions-hintcontext] new state InUse for Notify User 303
== Extension Changed 301[extensions-hintcontext] new state InUse for Notify User 302
-- Executing [99694191@DLPN_DialPlan301:1] Set("SIP/301-00000012", "ORGINEXTEN=99694191") in new stack

-- Executing [99694191@DLPN_DialPlan301:2] Set("SIP/301-00000012", "ORGINCONTEXT=DLPN_DialPlan301") in new stack

-- Executing [99694191@DLPN_DialPlan301:3] GetNextOutRouter("SIP/301-00000012", "DLPN_DialPlan301,") in new stack

-- Executing [99694191@DLPN_DialPlan301:4] GotoByTimeConditionOutBound("SIP/301-00000012", ",0") in new stack

-- Executing [99694191@DLPN_DialPlan301:5] Macro("SIP/301-00000012", "trunkdial-failover-0.3,1,,99694191,trunk-nexiva,") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:1] NoOp("SIP/301-00000012", "do call out") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:2] GotoIf("SIP/301-00000012", "0?Blacklist-Handle,s,1") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:3] GotoIf("SIP/301-00000012", "0?6:4)}") in new stack

-- Goto (macro-trunkdial-failover-0.3,s,4)

-- Executing [s@macro-trunkdial-failover-0.3:4] GotoIf("SIP/301-00000012", "0?5:6") in new stack

-- Goto (macro-trunkdial-failover-0.3,s,6)

-- Executing [s@macro-trunkdial-failover-0.3:6] Set("SIP/301-00000012", "TCOUNT=4") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:7] Set("SIP/301-00000012", "CDR(userfield)=Outbound") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:8] Set("SIP/301-00000012", "OldCallerID=301") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:9] Set("SIP/301-00000012", "TOUCH_MONITOR=301-99694191") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:10] NoOp("SIP/301-00000012", "") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:11] Set("SIP/301-00000012", "TIMEOUT(absolute)=0") in new stack
Channel hangup cancelled.
-- Executing [s@macro-trunkdial-failover-0.3:12] Set("SIP/301-00000012", "DLSTAT=UNKNOW}") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:13] SetCktCustom("SIP/301-00000012", "sendrpid,no,no") in new stack

-- Executing [s@macro-trunkdial-failover-0.3:14] GotoIf("SIP/301-00000012", "1>0?1-dial,1") in new stack

-- Goto (macro-trunkdial-failover-0.3,1-dial,1)

-- Executing [1-dial@macro-trunkdial-failover-0.3:1] GotoIf("SIP/301-00000012", "0?nextrouter,1") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:2] GotoIf("SIP/301-00000012", "0?setdod,1:1-dial,3") in new stack

-- Goto (macro-trunkdial-failover-0.3,1-dial,3)

-- Executing [1-dial@macro-trunkdial-failover-0.3:3] Set("SIP/301-00000012", "CALLERID(name)=546093546") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:4] Set("SIP/301-00000012", "CALLERID(num)=546093546") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:5] Set("SIP/301-00000012", "_SIPSRTP=0") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:6] Set("SIP/301-00000012", "OUTDIALOPT=tTkKWwXx") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:7] NoOp("SIP/301-00000012", "null for std") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:8] GotoIf("SIP/301-00000012", "0?sys-dial,1)}") in new stack

-- Executing [1-dial@macro-trunkdial-failover-0.3:9] Dial("SIP/301-00000012", "SIP/trunk-nexiva/99694191,,tTkKWwXx") in new stack
== Using SIP RTP TOS bits 184

== Using SIP RTP CoS mark 5
-- Called trunk-nexiva/99694191

-- SIP/trunk-nexiva-00000013 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
-- Executing [1-dial@macro-trunkdial-failover-0.3:10] Goto("SIP/301-00000012", "1-CONGESTION,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,1-CONGESTION,1)
-- Executing [1-CONGESTION@macro-trunkdial-failover-0.3:1] Set("SIP/301-00000012", "DLSTAT=9-CONGESTION") in new stack
-- Executing [1-CONGESTION@macro-trunkdial-failover-0.3:2] Goto("SIP/301-00000012", "2-dial,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,2-dial,1)
-- Executing [2-dial@macro-trunkdial-failover-0.3:1] Set("SIP/301-00000012", "TCOUNT=5") in new stack
-- Executing [2-dial@macro-trunkdial-failover-0.3:2] Goto("SIP/301-00000012", "1-dial,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,1-dial,1)
-- Executing [1-dial@macro-trunkdial-failover-0.3:1] GotoIf("SIP/301-00000012", "1?nextrouter,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,nextrouter,1)
-- Executing [nextrouter@macro-trunkdial-failover-0.3:1] GotoIf("SIP/301-00000012", "0?,99694191,1:9-CONGESTION,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,9-CONGESTION,1)
-- Executing [9-CONGESTION@macro-trunkdial-failover-0.3:1] Playback("SIP/301-00000012", "all-busy-now-try-call-later") in new stack

-- <SIP/301-00000012> Playing 'all-busy-now-try-call-later.gsm' (language 'en')
[2014-05-05 16:01:40] NOTICE[1791]: utils.c:305 HostPoolUpdater: ======host:sbc.voipdnsservers.com update dns======

== Spawn extension (macro-trunkdial-failover-0.3, 9-CONGESTION, 1) exited non-zero on 'SIP/301-00000012' in macro 'trunkdial-failover-0.3'

== Spawn extension (DLPN_DialPlan301, 99694191, 5) exited non-zero on 'SIP/301-00000012'
-- Executing [h@DLPN_DialPlan301:1] NoOp("SIP/301-00000012", "no thing to do") in new stack

-- Executing [h@DLPN_DialPlan301:2] Hangup("SIP/301-00000012", "") in new stack
== Spawn extension (DLPN_DialPlan301, h, 2) exited non-zero on 'SIP/301-00000012'

== Extension Changed 301[extensions-hintcontext] new state Idle for Notify User 304
== Extension Changed 301[extensions-hintcontext] new state Idle for Notify User 300
== Extension Changed 301[extensions-hintcontext] new state Idle for Notify User 303
== Extension Changed 301[extensions-hintcontext] new state Idle for Notify User 302

Thanks again for you help,
May 6, 2014 at 3:17 PM
I think there is a problem with you Asterisk setup! Best place to start is voip-info.org and #asterisk on irc.freenode.net. They'll be able to better help you.
May 7, 2014 at 2:45 PM
Asterisk The Future of Telephony O'Reilly Media. It will provide you everything about Asterisk.
May 13, 2014 at 2:12 PM
First of all I want to thank everybody who answered my post.
After reading some post in different forums and the Asterisk the future of telephony
i think that i understand better how asterisk works.

i made some changes in my program and i have the following error message

"Timeout waiting for Response to Originate"

what it's bizarre it's that my phone (extension 301) rings...

thanks for your help.