В логе SIP проблема заключается как я понял в этом:
в INVITE:
From: "Anonymous" <sip:79211234567@anonymous.invalid>;
и ответ сервера (мегафоновский Мультифон):
Received response: "Forbidden" from '"Anonymous" <sip:79211234567@anonymous.invalid>;
Настройки:
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER:
sip.conf
extensions.conf
Код: Выделить всё
[general]
callerid="79211234567"
context=default ; Default context for incoming calls
allowguest=no ; Allow or reject guest calls (default is yes)
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
allow=all ; Allow codecs in order of preference
useragent=X-Lite release 1011s stamp 41150
registertimeout=60 ; retry registration calls every 20 seconds (default)
register => 79211234567@multifon.ru:secret:79211234567@sbc.megafon.ru:5060/79211234567
sendrpid=yes
[authentication]
[basic-options](!) ; a template
dtmfmode=rfc2833
context=from-office
type=friend
[natted-phone](!,basic-options) ; another template inheriting basic-options
directmedia=no
host=dynamic
[public-phone](!,basic-options) ; another template inheriting basic-options
directmedia=yes
[my-codecs](!) ; a template for my preferred codecs
disallow=all
allow=ilbc
allow=g729
allow=gsm
allow=g723
allow=ulaw
[ulaw-phone](!) ; and another one for ulaw-only
disallow=all
allow=ulaw
[multifon]
dtmfmode=inband
username=79211234567
type=peer
secret=secret
host=sbc.megafon.ru
fromuser=79211234567
fromdomain=multifon.ru
port=5060
nat=no
context=incoming
insecure=port,invite
transport=tcp
qualify=no
callerid="79211234567" <79211234567>
Код: Выделить всё
[out]
exten =>_.,1,Dial(SIP/multifon/${EXTEN},60,t)
exten => h,1,NoOp(Call hunged up)
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER:
test.py
Код: Выделить всё
#!/usr/bin/python
# -*- coding: utf-8 -*-
import asterisk.manager
import sys
manager = asterisk.manager.Manager()
try:
try:
manager.connect('localhost')
manager.login('zabbix', 'zabbix')
response = manager.originate('SIP/79219876543@multifon','1',context='out',priority='1')
print response
manager.logoff()
except asterisk.manager.ManagerSocketException, (errno, reason):
print "Error connecting to the manager: %s" % reason
sys.exit(1)
except asterisk.manager.ManagerAuthException, reason:
print "Error logging in to the manager: %s" % reason
sys.exit(1)
except asterisk.manager.ManagerException, reason:
print "Error: %s" % reason
sys.exit(1)
finally:
manager.close()
Через SoftPhone звонки совершаются нормально, однако хотелось бы заставить работать и этот вариант.