Using Python AMI to make call

I want to make external call using python asterisk-ami Library

my current config is : )

Here is my current pjsip config for the outbound calls


root@debian-s-2vcpu-4gb-amd-sfo3-01:/etc/asterisk# cat pjsip.conf 
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
local_net = 10.48.0.9
external_media_address = <IP>
external_signaling_address = <ip>
;nat=force_rport,comedia



[bot]
type = registration
outbound_auth = bot
server_uri = sip:<ip>
client_uri = sip:46544@<ip>
retry_interval = 60

[bot]
type = auth
auth_type = userpass
username = 46544
password = apass 

[bot]
type = aor
max_contacts=10
qualify_frequency = 60
contact = sip:<IP>

[bot]
type = endpoint
context = test
transport = transport-udp
disallow = all
allow = ulaw
outbound_auth = otpbot
aors = otpbot
rewrite_contact = yes
force_rport = yes
rtp_symmetric = yes
rtp_keepalive = 5
media_use_received_transport = yes
from_user=46544
from_domain=<ip>




[bot]
type = identify
endpoint = bot
match = <ip>

This is the extentions.config

[globals]
TRUNK=bot

[test]
exten = _X.,1,Verbose("calling the mf")
 same => n,Dial(PJSIP/${EXTEN}@${TRUNK},60)
 same = n,Hangup()

This is my AMI code

from asterisk.ami import AMIClient , SimpleAction , AMIClientAdapter , EventListener

def originate_call(client, user):
    try:
        action = SimpleAction(
            "Originate",
            Channel=f"PJSIP/otpbot",  # Dial the user's number
            Context='test',              # Dial plan context
            Exten=f"{user['number']}",              # Extension to route the call
            Priority="1",            # Priority in the dial plan
            CallerID=CALLER_ID,                # Caller ID
            Timeout="30000",              # Timeout for the call
            Variable=f"ARG1={user['email']},ARG2={user['name']},ARG3={user['number']},ARG4={user['address']}" # Pass user data
        )
        response = client.send_action(action)
        print(f"Call initiated for {user['number']}: {response.response} , {CALLER_ID}")
    except Exception as e:
        print(f"Error originating call for {user['number']}: {e}")

problem is this that when ever i make the an out bound call through AMI it return originate fail and in log it show Busy

but when i call to any extention its works fine

even when i call from my soft phone it works perfect ( to external number )

what can be the possiable reasone that my external number is not reching from ami ??

regards
JH

You have configured “bot” in pjsip.conf, but in the AMI Originate you are calling “otpbot”, and not specifying a number or extension.

Also, outbound-auth, and aors, reference non-existent section names.

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
local_net = 10.48.0.9
external_media_address = <IP>
external_signaling_address = <IP>
;nat=force_rport,comedia



[otpbot]
type = registration
outbound_auth = otpbot
server_uri = sip:<IP>
client_uri = sip:46544@<IP>
retry_interval = 60

[otpbot]
type = auth
auth_type = userpass
username = 46544
password = ulDDhaBka00as

[otpbot]
type = aor
max_contacts=10
qualify_frequency = 60
contact = sip:<IP>

[otpbot]
type = endpoint
context = default
transport = transport-udp
disallow = all
allow = ulaw
outbound_auth = otpbot
aors = otpbot
rewrite_contact = yes
force_rport = yes
rtp_symmetric = yes
rtp_keepalive = 5
media_use_received_transport = yes
from_user=46544
from_domain=<IP>



[otpbot]
type = identify
endpoint = otpbot
match = <IP>

this is the correct config
but still same issue going

Please provide the Asterisk full log file. Issue the Asterisk CLI command “pjsip set logger on”, to get protocol logging. The full log file needs to be enabled.

<--- Examining AMI action: -->
Action: Login
Username: magnus
Secret: <redacted from logging>
ActionID: 0

<--- Examining AMI action: -->
Action: Originate
Channel: PJSIP/otpbot
Exten: 17747455118
Priority: 1
Context: test
CallerID: 1888654250
ActionID: 1

    -- Called otpbot
<--- Transmitting SIP request (904 bytes) to UDP:146.190.158.209:5060 --->
INVITE sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjea835ea9-e792-4c0d-8b33-c08cd4eb626f
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>
Contact: <sip:46544@24.199.112.223:5060>
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15503 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Type: application/sdp
Content-Length:   241

v=0
o=- 1506669399 1506669399 IN IP4 24.199.112.223
s=Asterisk
c=IN IP4 24.199.112.223
t=0 0
m=audio 28224 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<--- Received SIP response (577 bytes) from UDP:146.190.158.209:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 24.199.112.223:5060;branch=z9hG4bKPjea835ea9-e792-4c0d-8b33-c08cd4eb626f;received=24.199.112.223;rport=5060
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>;tag=as3e62eb43
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15503 INVITE
Server: MagnusBilling
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="335ed7d3"
Content-Length: 0


<--- Transmitting SIP request (386 bytes) to UDP:146.190.158.209:5060 --->
ACK sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjea835ea9-e792-4c0d-8b33-c08cd4eb626f
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>;tag=as3e62eb43
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15503 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Length:  0


<--- Transmitting SIP request (1067 bytes) to UDP:146.190.158.209:5060 --->
INVITE sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPj18a319dd-2bb6-42ce-ac26-01526f970ed5
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>
Contact: <sip:46544@24.199.112.223:5060>
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15504 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Authorization: Digest username="46544", realm="asterisk", nonce="335ed7d3", uri="sip:146.190.158.209", response="d4b901b12f98eeaecf15ce2a34968f2e", algorithm=MD5
Content-Type: application/sdp
Content-Length:   241

v=0
o=- 1506669399 1506669399 IN IP4 24.199.112.223
s=Asterisk
c=IN IP4 24.199.112.223
t=0 0
m=audio 28224 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<--- Received SIP response (498 bytes) from UDP:146.190.158.209:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 24.199.112.223:5060;branch=z9hG4bKPj18a319dd-2bb6-42ce-ac26-01526f970ed5;received=24.199.112.223;rport=5060
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>;tag=as3e62eb43
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15504 INVITE
Server: MagnusBilling
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<--- Transmitting SIP request (386 bytes) to UDP:146.190.158.209:5060 --->
ACK sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPj18a319dd-2bb6-42ce-ac26-01526f970ed5
From: <sip:46544@146.190.158.209>;tag=96881ce4-f2b1-4e1f-9b46-42614ab44ea7
To: <sip:146.190.158.209>;tag=as3e62eb43
Call-ID: b4a60978-1e34-4e9c-95ea-66ecc4fc9f00
CSeq: 15504 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Length:  0


<-- Examining AMI event (1754218554): -->
Event: Newchannel
Privilege: call,all
SequenceNumber: 12568
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389


<-- Examining AMI event (426736699): -->
Event: Newexten
Privilege: dialplan,all
SequenceNumber: 12569
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389
Extension: s
Application: AppDial2
AppData: (Outgoing Line)


<-- Examining AMI event (1831376705): -->
Event: NewCallerid
Privilege: call,all
SequenceNumber: 12570
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888654250
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389
CID-CallingPres: 0 (Presentation Allowed, Not Screened)


<-- Examining AMI event (633180392): -->
Event: NewConnectedLine
Privilege: call,all
SequenceNumber: 12571
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888654250
CallerIDName: <unknown>
ConnectedLineNum: 1888654250
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389


<-- Examining AMI event (2047349858): -->
Event: DialBegin
Privilege: call,all
SequenceNumber: 12572
File: manager_channels.c
Line: 1270
Func: channel_dial_cb
DestChannel: PJSIP/otpbot-00000134
DestChannelState: 0
DestChannelStateDesc: Down
DestCallerIDNum: 1888654250
DestCallerIDName: <unknown>
DestConnectedLineNum: 1888654250
DestConnectedLineName: <unknown>
DestLanguage: en
DestAccountCode: 
DestContext: test
DestExten: s
DestPriority: 1
DestUniqueid: 1737698050.389
DestLinkedid: 1737698050.389
DialString: otpbot


<-- Examining AMI event (1679088753): -->
Event: HangupRequest
Privilege: call,all
SequenceNumber: 12573
File: manager_channels.c
Line: 802
Func: channel_hangup_request_cb
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888654250
CallerIDName: <unknown>
ConnectedLineNum: 1888654250
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389
Cause: 21


<-- Examining AMI event (2013288170): -->
Event: DialEnd
Privilege: call,all
SequenceNumber: 12574
File: manager_channels.c
Line: 1280
Func: channel_dial_cb
DestChannel: PJSIP/otpbot-00000134
DestChannelState: 0
DestChannelStateDesc: Down
DestCallerIDNum: 1888654250
DestCallerIDName: <unknown>
DestConnectedLineNum: 1888654250
DestConnectedLineName: <unknown>
DestLanguage: en
DestAccountCode: 
DestContext: test
DestExten: s
DestPriority: 1
DestUniqueid: 1737698050.389
DestLinkedid: 1737698050.389
DialStatus: NOANSWER


<-- Examining AMI event (911141824): -->
Event: Hangup
Privilege: call,all
SequenceNumber: 12575
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000134
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888654250
CallerIDName: <unknown>
ConnectedLineNum: 1888654250
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737698050.389
Linkedid: 1737698050.389
Cause: 21
Cause-txt: Call Rejected


<--- Examining AMI action: -->
Action: Logoff
ActionID: 2

here is the whole pjsip and ami log

and this is my code


from asterisk.ami import AMIClient , SimpleAction , AMIClientAdapter , EventListener




try:
    # AMI Server Details
    client = AMIClient(address="0.0.00", port=5038)
    client.login(username="tets", secret="test")
    adapter = AMIClientAdapter(client)
    print("AMI login successful!")

    

    # action = SimpleAction("ping")
    # print(action)
    action = SimpleAction(
    'Originate',
    Channel='PJSIP/1001',
    Exten='17747455118',
    Priority=1,
    Context='default',
    CallerID='16096695933',
    )

    print(action)

    # Example action
    response = client.send_action(action)
    print(response.response)

    

    client.logoff()

except Exception as e:
    print(f"An error occurred: {e}")

here is my code

team help me i don’t what i am doing wrong

The log doesn’t match the code. The code originates to “1001” while your log shows it going to “otpbot”.

The log shows that a call was placed, challenged, and then sent with authentication but was rejected. Why that is - no idea.

Yea my bad i did several experiments
here is the all the revised info

this is what i am approaching

otpbot (registerd_trunk) ------> originate to destination_number : context(test)

// Here is PJSIP.conf


[otpbot]
type = registration
outbound_auth = otpbot
server_uri = sip:146.190.158.209
client_uri = sip:46544@146.190.158.209
retry_interval = 60

[otpbot]
type = auth
auth_type = userpass
username = 46544
password = apasshere

[otpbot]
type = aor
max_contacts=10
qualify_frequency = 60
contact = sip:146.190.158.209

[otpbot]
type = endpoint
context = test
transport = transport-udp
disallow = all
allow = ulaw
outbound_auth = otpbot
aors = otpbot
rewrite_contact = yes
force_rport = yes
rtp_symmetric = yes
rtp_keepalive = 5
media_use_received_transport = yes
from_user=46544
from_domain=146.190.158.209




[otpbot]
type = identify
endpoint = otpbot
match = 146.190.158.209

// Here is the extentions.conf

[globals]
TRUNK=otpbot

[test]
exten = _X.,1,Verbose("calling the mf")
 same => n,Dial(PJSIP/${EXTEN}@${TRUNK},60)
 same = n,Hangup()

// Here is the AMI code

from asterisk.ami import AMIClient , SimpleAction , AMIClientAdapter , EventListener

pnumber = "1888116765" 

try:
    # AMI Server Details
    client = AMIClient(address="24.199.112.223", port=5038)
    client.login(username="magnus", secret="meow")
    adapter = AMIClientAdapter(client)
    print("AMI login successful!")

    

    # action = SimpleAction("ping")
    # print(action)
    action = SimpleAction(
    'Originate',
    Channel='PJSIP/otpbot',
    Exten='17747455118',
    Priority=1,
    Context='test',
    CallerID=pnumber,
    )

    print(action)

    # Example action
    response = client.send_action(action)
    print(response.response)

    

    client.logoff()

except Exception as e:
    print(f"An error occurred: {e}")

// Here is the Python Output

..[$] <()> python meow_sample.py
AMI login successful!
Action: Originate
Channel: PJSIP/otpbot
Exten: 17747455118
Priority: 1
Context: test
CallerID: 1888116765

Response: Error
ActionID: 1
Message: Originate failed

//Here AMI and PJSIP log


<--- Examining AMI action: -->
Action: Login
Username: magnus
Secret: <redacted from logging>
ActionID: 0

<--- Examining AMI action: -->
Action: Originate
Channel: PJSIP/otpbot
Exten: 17747455118
Priority: 1
Context: test
CallerID: 1888116765
ActionID: 1

<--- Transmitting SIP request (902 bytes) to UDP:146.190.158.209:5060 --->
INVITE sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjfcfbce7b-63cd-4920-8147-5b7e0d22f20a
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>
Contact: <sip:46544@24.199.112.223:5060>
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24621 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Type: application/sdp
Content-Length:   239

v=0
o=- 416363154 416363154 IN IP4 24.199.112.223
s=Asterisk
c=IN IP4 24.199.112.223
t=0 0
m=audio 29684 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<--- Received SIP response (577 bytes) from UDP:146.190.158.209:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 24.199.112.223:5060;branch=z9hG4bKPjfcfbce7b-63cd-4920-8147-5b7e0d22f20a;received=24.199.112.223;rport=5060
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>;tag=as24e28bb9
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24621 INVITE
Server: MagnusBilling
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="4a314e21"
Content-Length: 0


<--- Transmitting SIP request (386 bytes) to UDP:146.190.158.209:5060 --->
ACK sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjfcfbce7b-63cd-4920-8147-5b7e0d22f20a
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>;tag=as24e28bb9
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24621 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Length:  0


<--- Transmitting SIP request (1065 bytes) to UDP:146.190.158.209:5060 --->
INVITE sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjfbf3f8c2-e577-40a7-99e6-05f705f8c8fd
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>
Contact: <sip:46544@24.199.112.223:5060>
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24622 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Authorization: Digest username="46544", realm="asterisk", nonce="4a314e21", uri="sip:146.190.158.209", response="dfa81b4fccf957b777a9ad468e93e401", algorithm=MD5
Content-Type: application/sdp
Content-Length:   239

v=0
o=- 416363154 416363154 IN IP4 24.199.112.223
s=Asterisk
c=IN IP4 24.199.112.223
t=0 0
m=audio 29684 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<--- Received SIP response (498 bytes) from UDP:146.190.158.209:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 24.199.112.223:5060;branch=z9hG4bKPjfbf3f8c2-e577-40a7-99e6-05f705f8c8fd;received=24.199.112.223;rport=5060
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>;tag=as24e28bb9
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24622 INVITE
Server: MagnusBilling
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<--- Transmitting SIP request (386 bytes) to UDP:146.190.158.209:5060 --->
ACK sip:146.190.158.209 SIP/2.0
Via: SIP/2.0/UDP 24.199.112.223:5060;rport;branch=z9hG4bKPjfbf3f8c2-e577-40a7-99e6-05f705f8c8fd
From: <sip:46544@146.190.158.209>;tag=0c4d77ac-1a0d-4221-9463-b34ffa381da6
To: <sip:146.190.158.209>;tag=as24e28bb9
Call-ID: 76ac919c-7cca-490f-b3df-cdb1b04937c9
CSeq: 24622 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 18.26.1
Content-Length:  0


<-- Examining AMI event (1754218554): -->
Event: Newchannel
Privilege: call,all
SequenceNumber: 13116
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481


<-- Examining AMI event (426736699): -->
Event: Newexten
Privilege: dialplan,all
SequenceNumber: 13117
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: <unknown>
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481
Extension: s
Application: AppDial2
AppData: (Outgoing Line)


<-- Examining AMI event (1831376705): -->
Event: NewCallerid
Privilege: call,all
SequenceNumber: 13118
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888116765
CallerIDName: <unknown>
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481
CID-CallingPres: 0 (Presentation Allowed, Not Screened)


<-- Examining AMI event (633180392): -->
Event: NewConnectedLine
Privilege: call,all
SequenceNumber: 13119
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888116765
CallerIDName: <unknown>
ConnectedLineNum: 1888116765
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481


<-- Examining AMI event (2047349858): -->
Event: DialBegin
Privilege: call,all
SequenceNumber: 13120
File: manager_channels.c
Line: 1270
Func: channel_dial_cb
DestChannel: PJSIP/otpbot-00000175
DestChannelState: 0
DestChannelStateDesc: Down
DestCallerIDNum: 1888116765
DestCallerIDName: <unknown>
DestConnectedLineNum: 1888116765
DestConnectedLineName: <unknown>
DestLanguage: en
DestAccountCode: 
DestContext: test
DestExten: s
DestPriority: 1
DestUniqueid: 1737797568.481
DestLinkedid: 1737797568.481
DialString: otpbot


<-- Examining AMI event (1679088753): -->
Event: HangupRequest
Privilege: call,all
SequenceNumber: 13121
File: manager_channels.c
Line: 802
Func: channel_hangup_request_cb
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888116765
CallerIDName: <unknown>
ConnectedLineNum: 1888116765
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481
Cause: 1


<-- Examining AMI event (2013288170): -->
Event: DialEnd
Privilege: call,all
SequenceNumber: 13122
File: manager_channels.c
Line: 1280
Func: channel_dial_cb
DestChannel: PJSIP/otpbot-00000175
DestChannelState: 0
DestChannelStateDesc: Down
DestCallerIDNum: 1888116765
DestCallerIDName: <unknown>
DestConnectedLineNum: 1888116765
DestConnectedLineName: <unknown>
DestLanguage: en
DestAccountCode: 
DestContext: test
DestExten: s
DestPriority: 1
DestUniqueid: 1737797568.481
DestLinkedid: 1737797568.481
DialStatus: NOANSWER


<-- Examining AMI event (911141824): -->
Event: Hangup
Privilege: call,all
SequenceNumber: 13123
File: manager_channels.c
Line: 743
Func: channel_snapshot_update
Channel: PJSIP/otpbot-00000175
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 1888116765
CallerIDName: <unknown>
ConnectedLineNum: 1888116765
ConnectedLineName: <unknown>
Language: en
AccountCode: 
Context: test
Exten: s
Priority: 1
Uniqueid: 1737797568.481
Linkedid: 1737797568.481
Cause: 1
Cause-txt: Unallocated (unassigned) number


<--- Examining AMI action: -->
Action: Logoff
ActionID: 2

<--- Received SIP request (1002 bytes) from UDP:110.235.218.240:50039 --->
REGISTER sip:24.199.112.223;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 10.40.135.150:50039;branch=z9hG4bK-524287-1---56b53fde59e8d255;rport
Max-Forwards: 70
Contact: <sip:1001@110.235.218.240:50039;transport=UDP;rinstance=e40179f325c0c346>
To: <sip:1001@24.199.112.223;transport=UDP>
From: <sip:1001@24.199.112.223;transport=UDP>;tag=a3b04554
Call-ID: obzXF3mluvMk8wVtv77R1Q..
CSeq: 491 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, sec-agree, outbound, path, X-cisco-serviceuri
User-Agent: Z 5.6.4 v2.10.20.4_1
Authorization: Digest username="1001",realm="asterisk",nonce="1737797515/35ff9db202d9d73971964158806253f8",uri="sip:24.199.112.223;transport=UDP",response="7b0afa3c384290331461cc099072672e",cnonce="0849b3c94b99278ef8809e955d388806",nc=00000002,qop=auth,algorithm=MD5,opaque="2e2181d553ad89c4"
Allow-Events: presence, kpml, talk, as-feature-event
Content-Length: 0


<--- Transmitting SIP response (525 bytes) to UDP:110.235.218.240:50039 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.40.135.150:50039;rport=50039;received=110.235.218.240;branch=z9hG4bK-524287-1---56b53fde59e8d255
Call-ID: obzXF3mluvMk8wVtv77R1Q..
From: <sip:1001@24.199.112.223>;tag=a3b04554
To: <sip:1001@24.199.112.223>;tag=z9hG4bK-524287-1---56b53fde59e8d255
CSeq: 491 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1737797569/bb3635817b17da8e4c5c91728729a573",opaque="18eed64328f27982",stale=true,algorithm=MD5,qop="auth"
Server: Asterisk PBX 18.26.1
Content-Length:  0


<--- Received SIP request (1002 bytes) from UDP:110.235.218.240:50039 --->
REGISTER sip:24.199.112.223;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 10.40.135.150:50039;branch=z9hG4bK-524287-1---c6937f1ef5ec131f;rport
Max-Forwards: 70
Contact: <sip:1001@110.235.218.240:50039;transport=UDP;rinstance=e40179f325c0c346>
To: <sip:1001@24.199.112.223;transport=UDP>
From: <sip:1001@24.199.112.223;transport=UDP>;tag=a3b04554
Call-ID: obzXF3mluvMk8wVtv77R1Q..
CSeq: 492 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, sec-agree, outbound, path, X-cisco-serviceuri
User-Agent: Z 5.6.4 v2.10.20.4_1
Authorization: Digest username="1001",realm="asterisk",nonce="1737797569/bb3635817b17da8e4c5c91728729a573",uri="sip:24.199.112.223;transport=UDP",response="260ff742eafe91bf06dc59b706ffaee0",cnonce="75d1b850f89d208146da2c785302bd6f",nc=00000001,qop=auth,algorithm=MD5,opaque="18eed64328f27982"
Allow-Events: presence, kpml, talk, as-feature-event
Content-Length: 0


<--- Transmitting SIP response (503 bytes) to UDP:110.235.218.240:50039 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.40.135.150:50039;rport=50039;received=110.235.218.240;branch=z9hG4bK-524287-1---c6937f1ef5ec131f
Call-ID: obzXF3mluvMk8wVtv77R1Q..
From: <sip:1001@24.199.112.223>;tag=a3b04554
To: <sip:1001@24.199.112.223>;tag=z9hG4bK-524287-1---c6937f1ef5ec131f
CSeq: 492 REGISTER
Date: Sat, 25 Jan 2025 09:32:49 GMT
Contact: <sip:1001@110.235.218.240:50039;transport=UDP;rinstance=e40179f325c0c346>;expires=59
Expires: 60
Server: Asterisk PBX 18.26.1
Content-Length:  0

i did several stuff nothing worked
help community members :cry:

46544 is not a valid number on the MagnusBilling system.

my sip is 46544 an calls going perfectly on soft phone through magnus

10 digits starting with 1?

You will get more informative error messages from Python if you don’t do this.