Tuesday, June 01, 2010

A good way to extract DNIS from extension

In cc.zonetel.com, when agent clicks-n-dial a customer, the customer-id and contact number are concatenated together and passed to dial plan, e.g, #<variable-length-cust-id>#<dnis>.  The two #s are used to enclose a generic customer id and the overall pattern is matched by '_#X.'.
Next, we need to separate the customerid and actual phone number.  The customerid, timestamp and dnis together go to our reporting logic while the dnis part is routed through pstn gateway.
The asterisk function CUT() (note : that CUT is UPPERCASE) is used to extract the customerid and dnis as below.
;; dnis format : #custid#dnis
;; the dnis is supposed to be the 3rd field
exten => _#X.,n,Set(cust_dnis=${CUT(EXTEN|#|3)})
exten => _#X.,n,dial(SIP/pstn_gateway/${cust_dnis})
Talk to me now via ZoiPPE! My ZoiPPE number is 85230003 

No comments:

Post a Comment