0

I have started working with the Asterisk AMI. Love it, have been learning a lot the last few days.

Now I want to make a call with the action:Originate

Have done this the following way;

//Make an action
Action: Originate
Channel: SIP/1001
Context: phones
Exten: 1000
Priority: 1  
The call comes true, but as soon as I pick up the call is disconnected.
Is there a way to make a call between two extensions.

The error code is as followed;

    -- Executing [1000@phones:3] NoOp("SIP/1001-0000000f", "Second Line") in new stack
    -- Executing [1000@phones:4] Dial("SIP/1001-0000000f", "SIP//") in new stack
[Aug 28 15:23:17] WARNING[13897][C-0000000c]: chan_sip.c:6267 create_addr: Purely numeric hostname (), and not a peer--rejecting!
[Aug 28 15:23:17] WARNING[13897][C-0000000c]: app_dial.c:2525 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [1000@phones:5] NoOp("SIP/1001-0000000f", "dialstatus=CHANUNAVAIL,causecode=20") in new stack
    -- Executing [1000@phones:6] Hangup("SIP/1001-0000000f", "") in new stack
  == Spawn extension (phones, 1000, 6) exited non-zero on 'SIP/1001-0000000f'

As you can see in this line;

-- Executing [1000@phones:4] Dial("SIP/1001-0000000f", "SIP//") in new stack

The second sip user is not set. I would say that this is the problem also by looking at the AMI output

Event: Hangup
Privilege: call,all
Channel: SIP/1001-00000010
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: ja
AccountCode: 
Context: phones
Exten: 1000
Priority: 6
Uniqueid: 1535440117.29
Linkedid: 1535440117.29
Cause: 20
Cause-txt: Subscriber absent

It says Subscriber absent. How can I set this with the AMI?

Is this even possible? Thank you.

[update]

extensions.conf

[phones]
exten =>  _XXXX,1,NoOp(First Line)
    same  => n,dumpchan()
    same  => n,NoOp(Second Line)
    same  => n,Dial(SIP/${CALLERID(dnid)}/${CALLERID(dnid)})
    same  => n,NoOp(dialstatus=${DIALSTATUS},causecode=${HANGUPCAUSE})
    same  => n,Hangup

sip.conf

[ACCOUNT-COMMON](!)
type=friend
nat=force_rport,comedia 
secret=123456
canreinvite=no
host=dynamic
dtmfmode=auto
callgroup=1
pickupgroup=1
videosupport=yes
qualify=yes
disallow=all
allow=all
;maxcallbitrate=1024   
context=phones


[1000](ACCOUNT-COMMON)
[1001](ACCOUNT-COMMON)
[1002](ACCOUNT-COMMON)
[1003](ACCOUNT-COMMON)
[1004](ACCOUNT-COMMON)
[1005](ACCOUNT-COMMON)
[1006](ACCOUNT-COMMON)
[1007](ACCOUNT-COMMON)
[1008](ACCOUNT-COMMON)
[1009](ACCOUNT-COMMON)
[1010](ACCOUNT-COMMON)
[1011](ACCOUNT-COMMON)
[1012](ACCOUNT-COMMON)
[1013](ACCOUNT-COMMON)
[1014](ACCOUNT-COMMON)
[1015](ACCOUNT-COMMON)
[1016](ACCOUNT-COMMON)
[1017](ACCOUNT-COMMON)
[1018](ACCOUNT-COMMON)
[1019](ACCOUNT-COMMON)
[1020](ACCOUNT-COMMON)

1 Answers1

1

in [phones] context (extensions.conf) use ${CALLERID(num)} not ${CALLERID(dnid)} like this: same => n,Dial(SIP/${CALLERID(num)})

not sure at the moment (cant check) but if i remember correctly alwaysauthreject=no in sip.conf would ignore purely numeric peers.

just dont go production with this :)

johaidi
  • 54
  • 3