简体   繁体   中英

Changing the caller number in an incoming call in asterisk

I am using asterisk.I have DID in which 4 numbers are mapped(stored in my database) so when user calls to that DID number the call is forwarded to the any one number mapped on that did. My problem is that when user calls to DID the one of the four executive receive calls from the DID number not with user number .This is my part of dialplan code the call is routed from another context(not given below) to the direct context

[direct]
exten => start,1,noop(######START######)
same => n,mysql(Query resultid ${connid} SELECT number from database);;;DDDDDD
same => n,MYSQL(Fetch fetchid ${resultid} number )
same => n,mysql(clear ${resultid})
same => n,set(__NUMBER=${number})
same => n,dial(DAHDI/g0/0${NUMBER},20,mM(ANSWEREDED))


[macro-ANSWEREDED]
exten => s,1,noop(CALL_ANSWERED)
exten => s,n,Mixmonitor(/recordings/record.wav)

How can i change the number that flashes on executive number(number mapped on DID) to the caller number? Thanks in advance.

1) Every asterisk book have example. Doing asterisk coding without reading book - not so nice idea

2) callerid can be set like this

same => n,set(__NUMBER=${number})
same => n,set(CALLERID(num)=123445678)
same => n,dial(DAHDI/g0/0${NUMBER},20,mM(ANSWEREDED))

3) If you use pstn dahdi connection(FXO card), that will not work. If you use digital connection, it can work if provider support that.

4) Use of app_mysql is depricated. Use func_odbc or realtime.

5) Use of mixmonitor inside on-call macro is extremly bad practice. Use mixmonitor with 'b' option before call out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM