Matthew Brothers wrote: >> Hi, >> >> I have been looking for an example of accomplishing this, but >> I've been unable to locate something similar to what I'm trying >> to do. >> >> Here's the scenario: >> >> Users caller ID is set to their internal extension (200-250). >> This is set in sip.conf for each user. Each user has a local DID >> as well (hosted through Vitelity, for example (555)111-2222). The >> problem is that this extension was being passed to the outside >> world. I currently have a SetCallerID command changing the >> CallerID to our main office number, but some users want their DID >> sent, not the general number. >> >> The problem is that if their caller ID is set to their DID, when >> users hit redial on their phones internally they dial out and >> back in. I corrected this by putting each DID in extensions.conf >> under their three digit extension, but that seems a bit like a >> kludge obviously. >> >> I'm looking for a method of sending the internal three digit >> extension only when a user is dialing another user internally, >> otherwise it will send their DID. Is their a method to do this in >> the dial plan? Anyone have an example of how to accomplish this? >> >> >> Thanks in advance. > > > Mike, > > I have a similar setup (I even use Vitel) and the easiest and > cleanest method that I have found to accomplish this is with the > AstDB. You can simply create a cross-reference of DIDs and Internal > extensions similar to extdid/200 => 5551112222 ... extdid/250 => > 5551112272 in the AstDB. Then you can change your outgoing dialplan > to change the caller id based upon this cross reference. Example: > > > exten => NXXNXXXXXX,n,Set(outgoingCID=<MAINNUMBER>) > > exten => NXXNXXXXXX,n, > GotoIf($[ ${DB_EXISTS(extdid/${CALLERID(num)})} = 0 ]?makecall) > > exten => NXXNXXXXXX,n, > Set(outgoingCID=${DB(extdid/${CALLERID(num)})}) > > exten => NXXNXXXXXX,n(makecall),Set(CALLERID(num)=${outgoingCID}) > > ... > > You could even simplify your incoming context by cross-referencing > in the other direction. That is didext/5551112222 => 200 ... > didext/5551112272 => 250. > > exten => NXXNXXXXXX,n, > Goto(internal-extensions,${DB(didext/${EXTEN})},1) > > OR you could do something similar with LOCAL channels or with a Dial > command.
Here is my solution. I've stripped out most of the unimportant stuff. Because our carrier charges for PICs on a per-DID basis, we set the Caller*ID number for long distance calls to be the main number, regardless of what the person's DID is. It also allows use of more than one main number, depending on the device making the call. The macro-dial-result is not important for this. It is a macro we use to figure out what happened to the call based on HANGUPCAUSE and what, if any tone or message to send the caller, as well as decide if the call failed and should be sent out a different route. In sip.conf set up the device like this: [0004f201e570-a] callerid=Room, Computer <3726> setvar=DID=9852463726 setvar=BTN=9858982022 accountcode=3726 type=friend host=dynamic secret=Shhhh context=toll-access My extensions.conf looks like this: [toll-access] ; ; 9-1-nxx-nxx-xxxx exten => _91NXXNXXXXXX,1,Set(USE_BTN=yes) exten => _91NXXNXXXXXX,n,Gosub(outgoing-call-fixup,${EXTEN},1) exten => _91NXXNXXXXXX,n,Dial(${PSTN}/${EXTEN:1},,g) exten => _91NXXNXXXXXX,n,Macro(dial-result,SIP/[EMAIL PROTECTED]) ; ; 9-1-985-nxx-xxxx exten => _91985NXXXXXX,1,Gosub(outgoing-call-fixup,${EXTEN},1) exten => _91985NXXXXXX,n,Dial(${PSTN}/${EXTEN:1},,g) exten => _91985NXXXXXX,n,Macro(dial-result,SIP/[EMAIL PROTECTED]) [outgoing-call-fixup] ; exten => _X.,1,GotoIf($[${LEN(${CALLERID(num)})} != 10]?check-btn) exten => _X.,n,Return exten => _X.,n(check-btn),GotoIf($["${USE_BTN}" = "yes"]?set-btn) exten => _X.,n,Set(CALLERID(num)=${DID}) exten => _X.,n,Return exten => _X.,n(set-btn),Set(CALLERID(num)=${BTN}) exten => _X.,n,Return _______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users