Dial same ext number on other asterisk

Hi there,

Hope you are all doing well,

I have asterisks installed on two pc on my local network for study purpose.
There are several ext number on each asterisk with exactly same number.
And I want all ext numbers on each asterisk can make/receive a call.
For example:
Asterisk A has ext number 1000, want to dial ext number 1000 on Asterisk B.
I have made the trunk on each asterisk, but i m still not able to make the dialplan logic to make tha call possibel, it always say rejected.

Please advise

Thank you

To take the literal question: use a routing prefix and strip it when it arrives at the other side.

However, I suspect that you are using SIP with a copied configuration which uses type=friend. That is rarely appropriate. Try using type=peer.

thank you for kind of reply

below are my config:

Asterisk-A
--------------
sip.conf

[general]
register => hp:semuasama@192.168.12.60/lenovo

[lenovo]
type=peer
secret=semuasama
host=dynamic
context=lenovo_incoming

[set](!)
type=friend
secret=semuasama
host=dynamic
context=phones

[1000](set)
[1001](set)
[2000](set)
[2001](set)

extensions.conf                                                     

[internal]
exten => _XXXX,1,NoOp()
exten => _XXXX,n,Log(NOTICE, Panggilan dari ${CALLERID(all)} ke : ${EXTEN} internal)
exten => _XXXX,n,Dial(SIP/${EXTEN},30)
exten => _XXXX,n,Hangup()

[remote]
exten => _024.,1,NoOp()
exten => _024.,n,Log(NOTICE, Panggilan dari ${CALLERID(all)} ke : ${EXTEN:3} melalui hp)
exten => _024.,n,Dial(SIP/hp/${EXTEN:3},20)
exten => _024.,n,Hangup()

[phones]
include => internal
include => remote

[hp_incoming]
include => internal
and then, For the Asterisk-B
--------------
sip.conf

[general]
register => lenovo:semuasama@192.168.12.27/hp

[hp]
type=peer
secret=semuasama
host=dynamic
context=hp_incoming

[set](!)
type=friend
secret=semuasama
host=dynamic
context=phones

[1000](set)
[1001](set)
[2000](set)
[2001](set)

extensions.conf                                                     

[internal]
exten => _XXXX,1,NoOp()
exten => _XXXX,n,Log(NOTICE, Panggilan dari ${CALLERID(all)} ke : ${EXTEN} internal)
exten => _XXXX,n,Dial(SIP/${EXTEN},30)
exten => _XXXX,n,Hangup()

[remote]
exten => _0274.,1,NoOp()
exten => _0274.,n,Log(NOTICE, Panggilan dari ${CALLERID(all)} ke : ${EXTEN:3} melalui lenovo)
exten => _0274.,n,Dial(SIP/lenovo/${EXTEN:4},20)
exten => _0274.,n,Hangup()

[phones]
include => internal
include => remote

[lenovo_incoming]
include => internal

and then from extension 1000 (server-A) dialing extension 1001 (server-B) get the below result:

 == Using SIP RTP CoS mark 5
    -- Executing [0241001@phones:1] NoOp("SIP/1000-00000012", "") in new stack
    -- Executing [0241001@phones:2] Log("SIP/1000-00000012", "NOTICE, Panggilan dari "" <1000> ke : 1001 melalui hp") in new stack
[Sep  8 10:09:18] NOTICE[6280][C-0000000d]: Ext. 0241001:2 @ phones:  Panggilan dari "" <1000> ke : 1001 melalui hp
    -- Executing [0241001@phones:3] Dial("SIP/1000-00000012", "SIP/hp/1001,20") in new stack
  == Using SIP RTP CoS mark 5
[Sep  8 10:09:18] ERROR[6280][C-0000000d]: netsock2.c:303 ast_sockaddr_resolve: getaddrinfo("hp", "(null)", ...): No address associated with hostname
[Sep  8 10:09:18] WARNING[6280][C-0000000d]: chan_sip.c:6373 create_addr: No such host: hp
[Sep  8 10:09:18] WARNING[6280][C-0000000d]: app_dial.c:2507 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 [0241001@phones:4] Hangup("SIP/1000-00000012", "") in new stack
  == Spawn extension (phones, 0241001, 4) exited non-zero on 'SIP/1000-00000012'

log (/var/log/asterisk) :

[Sep  8 10:09:18] NOTICE[6280][C-0000000d] Ext. 0241001:  Panggilan dari "" <1000> ke : 1001 melalui hp
[Sep  8 10:09:18] ERROR[6280][C-0000000d] netsock2.c: getaddrinfo("hp", "(null)", ...): No address associated with hostname
[Sep  8 10:09:18] WARNING[6280][C-0000000d] chan_sip.c: No such host: hp
[Sep  8 10:09:18] WARNING[6280][C-0000000d] app_dial.c: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)

please advise

many thanks
sadi

On Asterisk-A you have configured the dialplan to dial using a SIP peer named “hp” but it does not exist.

Also, you seem to be trying to have dynamic hosts on both sides, which will never work, and is also silly, as you appear to be issuing register from both sides, so you know both static addresses. The purpose of register is to inform the other side of an address they do not already know.

Also, you seem to have specified callback extensions, which I think pretty much guarantees that the destination phone number will be overwritten by that extension. However, that also comes down to the inappropriate use of dynamic hosts.

As already noted, the entries for the phones should be type=peer, or you will have problems with calls being authenticated against caller IDs, and failing.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.