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 