Dear team,
iam facing issue in making outgoing call. please help to fix it
message in asterisk:
CLI> !python /root/connect.py
– Attempting call on SIP/mainsip/+ for @test:1 (Retry 1)
== Using SIP RTP CoS mark 5
– Called mainsip/+
[Mar 14 06:37:51] WARNING[33245]: chan_sip.c:24424 handle_response_invite: Received response: “Forbidden” from ‘<sip:12345@:5060>;tag=as057df08d’
[Mar 14 06:37:51] NOTICE[35260]: pbx_spool.c:450 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[Mar 14 06:37:51] NOTICE[35260]: pbx_spool.c:453 attempt_thread: Queued call to SIP/mainsip/+ expired without completion after 0 attempts
CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
mainsip/mainsip 127.0.0.1 Yes Yes 5060 OK (116 ms)
sip conf below
[mainsip]
defaultuser=mainsip
secret=123
host=dynamic
context=my-context
type=friend
nat=force_rport,comedia
qualify=yes
disallow=all
allow=alaw,ulaw,g729
lastms=117
insecure=port,invite
directmedia=no
Python file content:
cat /root/connect.py
import psycopg2,os
from psycopg2 import Error
try:
conn=psycopg2.connect(user=“postgres”,password=“1234”,host=“localhost”,port=“5432”,database=“number”)
cursor = conn.cursor()
cursor.execute(“select mobno from numbers where flag=0”)
record = cursor.fetchall()
for records in record:
mobno = str(records[0])
print(mobno)
os.system('rm -rf /var/spool/asterisk/Numbers/'+mobno)
file = open('/var/spool/asterisk/Numbers/'+mobno, 'a')
file.write('Channel: SIP/mainsip/+'+mobno)
file.write('\nContext: test')
file.write('\nExtension: +'+mobno)
file.write('\nPriority: 1')
file.write('\nCallerID: 12345')
file.write('\n')
file.close()
os.system('cp /var/spool/asterisk/Numbers/'+mobno+ ' /var/spool/asterisk/outgoing/')
except (Exception, Error) as error:
print “H”;
finally:
if (conn):
cursor.close()
conn.close()
thanks and regards