Пожалуйста, войдите здесь. Часто задаваемые вопросы О нас
Задайте Ваш вопрос

sip trunk между asterisk

0

Есть пример из книжки Asterisk: the definitive guide 2013 года. Но не получается. Два однотипных Asterisk 11.8.1 Поставленных с нуля.

ServerA: 192.168.0.177

sip.conf

 [general]
allowguest=no                   ; disable unauthenticated calls
srvlookup=no                    ; disable DNS SRV record lookup on outbound calls
                                ; (unless you have a reliable DNS connection,
                                ; in which case yes)
udpbindaddr=192.168.0.177               ; listen for UDP requests on all interfaces
tcpenable=no                    ; disable TCP support

[office-phone](!)               ; create a template for our devices
type=friend                     ; the channel driver will match on username first,
                                ; IP second
context=LocalSets               ; this is where calls from the device will ente
                                ; the dialplan
host=dynamic                    ; the device will register with asterisk
nat=force_rport,comedia         ; assume device is behind NAT
; *** NAT stands for Network Address Translation,
; which allows multiple internal devices to share an
; external IP address.
dtmfmode=auto                   ; accept touch-tones from the devices, negotiated
                                ; automatically
disallow=all                    ; reset which voice codecs this device will accept or offer
allow=g722                      ; audio codecs to accept from, and request to, the device
allow=ulaw                      ; in the order we prefer
allow=alaw
; define a device name and use the office-phone template

[0000FFFF0001](office-phone)
secret=aaaaVVV2222 ; a unique password for this device --

[0000FFFF0002](office-phone)
secret=bbbbVVV2222 ; a unique password for this device --

[ServerB]
type=peer
host=192.168.0.175
defaultuser=ServerA
secret=111
context=incoming
disallow=all
allow=ulaw

extensions.conf

[LocalSets]
exten => 101,1,Dial(SIP/0000FFFF0001)
exten => 102,1,Dial(SIP/0000FFFF0002)

exten => 200,1,Progress()
 same => n,Answer()
 same => n,Playback(hello-world)
 same => n,Hangup()

exten => 201,1,Goto(TestMenu,start,1)
include => external

[external]
exten => _6XXX,1,Dial(SIP/ServerB/${EXTEN:1})

[TestMenu]
exten => start,1,Answer()
 same => n,Background(enter-ext-of-person)
 same => n,WaitExten(5)

exten => 1,1,Playback(digits/1)
 same => n,Goto(TestMenu,start,1)

exten => 2,1,Playback(digits/2)
 same => n,Goto(TestMenu,start,1)

exten => 0,1,Playback(vm-goodbye)
 same => n,Hangup()

exten => i,1,Playback(pbx-invalid)
 same => n,Goto(TestMenu,start,1)

exten => t,1,Playback(vm-goodbye)
 same => n,Hangup()

[incoming]
exten => _XXX,1,Goto(LocalSets,${EXTEN},1)

ServerB: 192.168.0.175

sip.conf

[general]
allowguest=no                   ; disable unauthenticated calls
srvlookup=no                    ; disable DNS SRV record lookup on outbound calls
                                ; (unless you have a reliable DNS connection,
                                ; in which case yes)
udpbindaddr=192.168.0.175               ; listen for UDP requests on all interfaces
tcpenable=no                    ; disable TCP support

[office-phone](!)               ; create a template for our devices
type=friend                     ; the channel driver will match on username first,
                                ; IP second
context=LocalSets               ; this is where calls from the device will ente
                                ; the dialplan
host=dynamic                    ; the device will register with asterisk
nat=force_rport,comedia         ; assume device is behind NAT
; *** NAT stands for Network Address Translation,
; which allows multiple internal devices to share an
; external IP address.
dtmfmode=auto                   ; accept touch-tones from the devices, negotiated
                                ; automatically
disallow=all                    ; reset which voice codecs this device will accept or offer
allow=g722                      ; audio codecs to accept from, and request to, the device
allow=ulaw                      ; in the order we prefer
allow=alaw
; define a device name and use the office-phone template

[0000FFFF0001](office-phone)
secret=aaaaVVV2222 ; a unique password for this device --

[0000FFFF0002](office-phone)
secret=bbbbVVV2222 ; a unique password for this device --

[ServerA]
type=peer
host=192.168.0.177
defaultuser=ServerB
secret=111
context=incoming
disallow=all
allow=ulaw

extensions.conf

[LocalSets]

exten => 101,1,Dial(SIP/0000FFFF0001)
exten => 102,1,Dial(SIP/0000FFFF0002)

exten => 200,1,Progress()
 same => n,Answer()
 same => n,Playback(hello-world)
 same => n,Hangup()

exten => 201,1,Goto(TestMenu,start,1)
include => external

[external]
exten => _5XXX,1,Dial(SIP/${EXTEN:1}@ServerA)

[TestMenu]
exten => start,1,Answer()
 same => n,Background(enter-ext-of-person)
 same => n,WaitExten(5)

exten => 1,1,Playback(digits/1)
 same => n,Goto(TestMenu,start,1)

exten => 2,1,Playback(digits/2)
 same => n,Goto(TestMenu,start,1)

exten => 0,1,Playback(vm-goodbye)
 same => n,Hangup()

exten => i,1,Playback(pbx-invalid)
 same => n,Goto(TestMenu,start,1)

exten => t,1,Playback(vm-goodbye)
 same => n,Hangup()

[incoming]
exten => _XXX,1,Goto(LocalSets,${EXTEN},1)

При наборе на софтфоне с сервера A 6101 получаем:

    -- Executing [6101@LocalSets:1] Dial("SIP/0000FFFF0001-0000001d", "SIP/ServerB/101") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/ServerB/101
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'SIP/0000FFFF0001-0000001d' status is 'CHANUNAVAIL'

В общем нужна помощь. Ip tables отключен, звонки на локальные клиенты проходят, никаких натов нет, айпи статические, хотя и висят физически на одной машине в виртуалках, сквозной пинг проходит. Ответ awsswa не помог.

zzuz Ладно, хорошо, почему текущий конфиг не работает вообще?

UPDATE Сделал все точно как в книге, включил дебаг для пира

SIP Debugging Enabled for IP: 192.168.0.175
  == Using SIP RTP CoS mark 5
    -- Executing [6102@LocalSets:1] Dial("SIP/0000FFFF0001-00000004", "SIP/102@ServerB") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 11532
Adding codec 100003 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.0.175:5060:
INVITE sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.8.1
Date: Thu, 08 May 2014 10:17:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 237

v=0
o=root 1718078034 1718078034 IN IP4 192.168.0.177
s=Asterisk PBX 11.8.1
c=IN IP4 192.168.0.177
t=0 0
m=audio 11532 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
    -- Called SIP/102@ServerB

<--- SIP read from UDP:192.168.0.175:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415;received=192.168.0.177;rport=5060
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 INVITE
Server: Asterisk PBX 11.8.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="68304c97"
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
Transmitting (no NAT) to 192.168.0.175:5060:
ACK sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 11.8.1
Content-Length: 0


---
Audio is at 11532
Adding codec 100003 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.0.175:5060:
INVITE sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 INVITE
User-Agent: Asterisk PBX 11.8.1
Authorization: Digest username="ServerA", realm="asterisk", algorithm=MD5, uri="sip:102@192.168.0.175", nonce="68304c97", response="de5f5f97eb8aacb9e6705aab96bf148c"
Date: Thu, 08 May 2014 10:17:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 237

v=0
o=root 1718078034 1718078035 IN IP4 192.168.0.177
s=Asterisk PBX 11.8.1
c=IN IP4 192.168.0.177
t=0 0
m=audio 11532 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---

<--- SIP read from UDP:192.168.0.175:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733;received=192.168.0.177;rport=5060
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 INVITE
Server: Asterisk PBX 11.8.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Transmitting (no NAT) to 192.168.0.175:5060:
ACK sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 11.8.1
Content-Length: 0


---
Scheduling destruction of SIP dialog '47e3f4892beb1675570863991419e4b9@192.168.0.177:5060' in 32000 ms (Method: INVITE)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'SIP/0000FFFF0001-00000004' status is 'CHANUNAVAIL'

И сервер B:

<--- SIP read from UDP:192.168.0.177:5060 --->
INVITE sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.8.1
Date: Thu, 08 May 2014 10:17:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 237

v=0
o=root 1718078034 1718078034 IN IP4 192.168.0.177
s=Asterisk PBX 11.8.1
c=IN IP4 192.168.0.177
t=0 0
m=audio 11532 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
<------------->
--- (14 headers 11 lines) ---
Sending to 192.168.0.177:5060 (no NAT)
Sending to 192.168.0.177:5060 (no NAT)
Using INVITE request as basis request - 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
Found peer '0000FFFF0001' for '0000FFFF0001' from 192.168.0.177:5060

<--- Reliably Transmitting (NAT) to 192.168.0.177:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415;received=192.168.0.177;rport=5060
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 INVITE
Server: Asterisk PBX 11.8.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="68304c97"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '47e3f4892beb1675570863991419e4b9@192.168.0.177:5060' in 32000 ms (Method: INVITE)

<--- SIP read from UDP:192.168.0.177:5060 --->
ACK sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK0e638415
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 11.8.1
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:192.168.0.177:5060 --->
INVITE sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 INVITE
User-Agent: Asterisk PBX 11.8.1
Authorization: Digest username="ServerA", realm="asterisk", algorithm=MD5, uri="sip:102@192.168.0.175", nonce="68304c97", response="de5f5f97eb8aacb9e6705aab96bf148c"
Date: Thu, 08 May 2014 10:17:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 237

v=0
o=root 1718078034 1718078035 IN IP4 192.168.0.177
s=Asterisk PBX 11.8.1
c=IN IP4 192.168.0.177
t=0 0
m=audio 11532 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
<------------->
--- (15 headers 11 lines) ---
Sending to 192.168.0.177:5060 (NAT)
Using INVITE request as basis request - 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
Found peer '0000FFFF0001' for '0000FFFF0001' from 192.168.0.177:5060

<--- Reliably Transmitting (NAT) to 192.168.0.177:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733;received=192.168.0.177;rport=5060
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 INVITE
Server: Asterisk PBX 11.8.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '47e3f4892beb1675570863991419e4b9@192.168.0.177:5060' in 32000 ms (Method: INVITE)

<--- SIP read from UDP:192.168.0.177:5060 --->
ACK sip:102@192.168.0.175 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.177:5060;branch=z9hG4bK52b46733
Max-Forwards: 70
From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
To: <sip:102@192.168.0.175>;tag=as0fdd78d3
Contact: <sip:0000FFFF0001@192.168.0.177:5060>
Call-ID: 47e3f4892beb1675570863991419e4b9@192.168.0.177:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 11.8.1
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
Really destroying SIP dialog '47e3f4892beb1675570863991419e4b9@192.168.0.177:5060' Method: ACK
удалить закрыть спам изменить тег редактировать

спросил 2014-05-08 10:04:26 +0400

tw1911 Gravatar tw1911
1 2 3

обновил 2014-05-08 14:38:04 +0400

Comments

Посто обновлен

tw1911 ( 2014-05-08 11:08:17 +0400 )редактировать

После всех ответов рабочий конфиг так и не выработан. Добавление insecure=invite не дает желанного результата. Еще раз поясню, что уменно такой конфиг был в книге, я его не вырывал и принципиально не менял.

tw1911 ( 2014-05-08 15:02:10 +0400 )редактировать

Вы вызываете ServerB/num , в котором defaultuser=ServerA , но в конфиге ServerA стоит defaultuser=ServerB .

zzuz ( 2014-05-08 18:02:32 +0400 )редактировать

4 Ответа

0

У Вас явно прописаны IP.. Может Вам и не нужна авторизация?

[serverA]
type = friend

host = 192.168.1.101

context = incoming

disallow = all

allow = ulaw

[ServerB]

type=friend

host=192.168.0.175

context=incoming

disallow=all

allow=ulaw

ссылка удалить спам редактировать

ответил 2014-05-09 20:01:04 +0400

shirker Gravatar shirker
1 1
0
 From: <sip:0000FFFF0001@192.168.0.177>;tag=as725d5ac3
 To: <sip:102@192.168.0.175>

Это говорит о том, что у пиров не настроено поле fromuser=

На будущее, читайте правильные источники..

Там же четко расписано:

[mysipprovider-out]
  type=peer
  secret=password
  username=2345
  host=sipserver.mysipprovider.com
  fromuser=2345
  fromdomain=fwd.pulver.com
  canreinvite=no
  insecure=invite,port
  qualify=yes
  nat=yes
  context=from-mysipprovider ; this section will be defined in extensions.conf
ссылка удалить спам редактировать

ответил 2014-05-08 18:29:39 +0400

Zavr2008 Gravatar Zavr2008 flag of Russian Federation
2886 11 9 40
http://mh.otx.ru/

обновил 2014-05-08 18:30:26 +0400

Comments

TC - Вы попробовали задать fromuser?

Zavr2008 ( 2014-05-15 02:44:08 +0400 )редактировать
0

Чтобы что-то регистрировать на другом сервере на нем должно быть выставлено host=dynamic . Внимательней читайте книгу.

ссылка удалить спам редактировать

ответил 2014-05-08 12:45:15 +0400

zzuz Gravatar zzuz flag of Russian Federation
7174 2 6 75
http://line24.ru/

Comments

Не работает , потому что серверу B посылаетеся неаунтентифицированный INVITE . Во-первых для регистрации в настройках пира нет ни логина , ни пароля. во-вторых, если их не использовать то необходим insecure=invite для входящего вызова. Выдирать часть конфига из книги и потом разводить руками - неверный путь.

zzuz ( 2014-05-08 14:10:41 +0400 )редактировать
0
ссылка удалить спам редактировать

ответил 2014-05-08 10:38:56 +0400

awsswa Gravatar awsswa flag of Russian Federation
685 5 2 9

Ваш ответ

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[скрыть предварительный просмотр]

Закладки и информация

Добавить закладку

подписаться на rss ленту новостей

Статистика

Задан: 2014-05-08 10:04:26 +0400

Просмотрен: 5,102 раз

Обновлен: May 09 '14

Похожие вопросы:

Проект компании "АТС Дизайн"
Asterisk® и Digium® являются зарегистрированными торговыми марками компании Digium, Inc., США.
IP АТС Asterisk распространяется под лицензией GNU GPL.