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