Unregestring extension from Asterisk

sachin
edited May 2022 in asterisk

Getting registered extension

In Asterisk command line

database show registrar/contact

In terminal

asterisk -rx "database show registrar/contact"

In AMI

Action: PJSIPShowContacts

In AMI if you have key

Action: DBGet
Family: registrar/contact
Key: 1004103;@375b96bf1bcc0d5db6cbc5da475af02a

Output of this will be like

/registrar/contact/1004103;@375b96bf1bcc0d5db6cbc5da475af02a: {"via_addr":"192.168.2.120","qualify_timeout":"3.000000","call_id":"eRfGCyROfV","reg_server":"","prune_on_boot":"no","path":"","endpoint":"1004103","via_port":"5060","authenticate_qualify":"no","uri":"sip:1004103@192.168.2.3:30696","qualify_frequency":"0","user_agent":"Linphone Desktop/4.4.1 (DESKTOP-7QJRSE9) Windows 10 Version 2009, Qt 5.15.2 LinphoneCore/5.1.19-1-g6cdd0918e","expiration_time":"1653388961","outbound_proxy":""}
1 results found.


To delete this registration

In Asterisk command line

database del registrar/contact 1004103;@375b96bf1bcc0d5db6cbc5da475af02a

In terminal

asterisk -rx "database del registrar/contact 1004103;@375b96bf1bcc0d5db6cbc5da475af02a"

In AMI

Action: DBDel
Family: registrar/contact
Key: 1004103;@375b96bf1bcc0d5db6cbc5da475af02a

In dial plan, value of same can be get via

exten => _X.,n,Set(CDR(user_extn)=${CUT(CDR(accountcode),-,1)})
exten => _X.,n,NoOp(${PJSIP_AOR(${CDR(user_extn)},contact)})
exten => _X.,n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${CDR(user_extn)},contact)},status)})
exten => _X.,n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${CDR(user_extn)},contact)},call_id)})
exten => _X.,n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${CDR(user_extn)},contact)},user_agent)})
exten => _X.,n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${CDR(user_extn)},contact)},uri)})
exten => _X.,n,NoOp(${PJSIP_CONTACT(${PJSIP_AOR(${CDR(user_extn)},contact)},rtt)})
Tagged:
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!