[asterisk-users] modifying CID for different trunks

Oguzhan Kayhan oguzhank at bilkent.edu.tr
Wed Jun 17 04:56:36 CDT 2009


> 2009/6/17 Oguzhan Kayhan <oguzhank at bilkent.edu.tr>
>
>> Hi,
>> I have 2 trunks connected to my asterisk installation.
>> One is a inbound connection between ericsson pbx  and the other is thru
>> a
>> voip service.
>>
>> I am using 4 digit numbers both in ericsson and asterisk..
>> And also i have full real prefix for that numbers..
>> As all 290XXXX are real numbers and if smbody dials 290XXXX from outside
>> XXXX starts to ring without a problem.
>>
>> Now.. My problem is, from asterisk side, both ericsson and trunk are
>> outside trunks..
>> So.. if i dont enter any Caller ID for an extension, 4 digit caller
>> id(internal CID) is sent to both trunks.. This is waht i want for
>> ericsson
>> trunk but not the other one..
>> So, how can i modify CID for a single trunk, so if i dial ericsson i can
>> use 4 digit one, and if i dial other trunk i can add smthing like 290 to
>> all outgoing CID data..
>>
>>
>>
>> Hello, you can try to do a Set(${Callerid(num)}=290XXX) before call if
>> you
> are using asterisk 1.2 the $var is different, search wiki. Tell us if it
> works for you. Also your provider need to acept your number, so be sure he
> is.
> Have a good day.



Hello, i tried 2 configs..
I am using 1.6 by the way..

First one works ok as:
exten = _0XXXXXXXXXX,1,Set(OrigName=${CALLERID(num))
exten = _0XXXXXXXXXX,n,Set(CALLERID(num)=0312290${OrigName})
exten = _0XXXXXXXXXX,n,Dial(SIP/Superonline/${EXTEN:0})
And i can see the the called id correctly..
But in this case, the asterisk-gui and failover trunk scripts doesnt work.

When i do the config as follows:
exten = _0XXXXXXXXXX,1,Set(OrigName=${CALLERID(num))
exten = _0XXXXXXXXXX,n,Set(CALLERID(num)=0312290${OrigName})
exten =
_0XXXXXXXXXX,n,Macro(trunkdial-failover-0.3,${Superonline}/${EXTEN:0},,Superonline,)

Smthing in the macro removes the CID i think and i got the following from
field in sip debug.

From: "asterisk" <sip:asterisk at xxx.xxx.xxx.xxx>;tag=as13df8c95

So i got "unknown" on my phone as CID :(

Here's the Macro for trunk-dial.

[macro-trunkdial-failover-0.3]
exten = s,1,GotoIf($[${LEN(${FMCIDNUM})} > 6]?1-fmsetcid,1)
exten = s,2,GotoIf($[${LEN(${GLOBAL_OUTBOUNDCIDNAME})} > 1]?1-setgbobname,1)
exten = s,3,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} >
2]?${CID_${CALLERID(num)}}:)})
exten = s,n,GotoIf($[${LEN(${CALLERID(num)})} > 6]?1-dial,1)
exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${CID_${ARG3}})} >
6]?${CID_${ARG3}}:${GLOBAL_OUTBOUNDCID})})
exten = s,n,Goto(1-dial,1)
exten = 1-setgbobname,1,Set(CALLERID(name)=${GLOBAL_OUTBOUNDCIDNAME})
exten = 1-setgbobname,n,Goto(s,3)
exten = 1-fmsetcid,1,Set(CALLERID(num)=${FMCIDNUM})
exten = 1-fmsetcid,n,Set(CALLERID(name)=${FMCIDNAME})
exten = 1-fmsetcid,n,Goto(1-dial,1)
exten = 1-dial,1,Dial(${ARG1})
exten = 1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1)
exten = 1-CHANUNAVAIL,1,Dial(${ARG2})
exten = 1-CHANUNAVAIL,n,Hangup()
exten = 1-CONGESTION,1,Dial(${ARG2})
exten = 1-CONGESTION,n,Hangup()











> _______________________________________________
> -- 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





More information about the asterisk-users mailing list