Showing posts with label asterisk. Show all posts
Showing posts with label asterisk. Show all posts

Asterisk AST_SORCERY function

 AST_SORCERY gets a field from a sorcery object. Sorcery is always created for PJSIP aors, endpoints and identifies in asterisk. It allows you to access information from dialplan in runtime.

Syntax:

AST_SORCERY(module_name,object_type,object_id,field_name[,retrieval_method[,retrieval_details]])

PJSIP config example:

[mytrunk]
type=aor
contact=sip:sip.example.com:5060

[mytrunk]
type=endpoint
context=from-external
disallow=all
allow=ulaw,alaw,g722
outbound_auth=mytrunk
aors=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=sip.example.com


Usage example:

> dialplan eval function AST_SORCERY(res_pjsip,identify,mytrunk,match)

Return Value: Success (0)

Result: sip.example.com

> dialplan eval function AST_SORCERY(res_pjsip,endpoint,mytrunk,allow)

Return Value: Success (0)

Result: (ulaw|alaw|g722)


Enjoy!

Asterisk: HOWTO forward DNIS to remote party

Dialed Number Identification Service (DNIS) is a service that lets determine which telephone number was dialed by a customer.

Usually dialed number is known for subscriber, because each DID corresponds unique extension.
It is not a case for transfered calls, because information about DID will be lost. To inform far side about original dialed number the SIP protocol provides the Diversion header.
To set the Diversion field you have to set rdnis variable in dialplan. E.g.


;catch all extension
exten=>_.,n,Set(CALLERID(rdnis)=${EXTEN})

;in the macro
exten=>s,n,Set(CALLERID(rdnis)=${MACRO_EXTEN})

; or hardcoded
exten=>_.,n,Set(CALLERID(rdnis)=123456789)

Enjoy!

Asterisk AST_SORCERY function

 AST_SORCERY gets a field from a sorcery object. Sorcery is always created for PJSIP aors, endpoints and identifies in asterisk. It allows y...