Call tying
Материал из fidoman.ru
Save number called from internal extension into DB.
When call received from that number it is routed directly to that extension.
Dialplan for outgoing calls:
exten => _8XXXXXXXXXX,1,Set(DB(lastcall_trunkname/${EXTEN})=${CALLERID(num)})
Dialplan for incoming calls:
same => n,Gosubif(${DB_EXISTS(lastcall_trunkname/${CALLERID(num)})}?internal_dialplan,${DB(lastcall_trunkname/${CALLERID(num)})},1)
Better is to use call tying only for one incoming call (then reset to default), then change DB in the dialplan to DB_DELETE (it gets the value then deletes it).