Call forwarding issue (CF not populating to database)

Hello,

I have call forwarding configured via an ael dialplan. The dialplan works and after users authenticate and enter forwarding options the CF key is not being populated in the database. What am I missing? See dialplan and cli verbose output below:

*71 => {
Answer();
Playback(please-enter-the);
Playback(extension);
Read(ext,then-press-pound);
Authenticate(/etc/asterisk/pins.conf,am);
Background(ent-target-attendant);
Read(toext,then-press-pound);
Wait(1);
Set(DB(CF/{ext}={toext}));
Playback(call-fwd-unconditional);
Playback(for);
Playback(extension);
SayDigits({ext}); Playback(is-set-to); SayDigits({toext});
Playback(auth-thankyou);
Hangup();
};

-------------------cli verbose output--------------------------

Executing [*71@outbound_office:1] Answer(“SIP/101-000002e4”, “”) in new stack
> 0x7f7a30927590 – Strict RTP switching to RTP target address 10.1.11.76:4100 as source
– Executing [*71@outbound_office:2] Playback(“SIP/101-000002e4”, “loligo/sounds/please-enter-the”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/please-enter-the.gsm’ (language ‘en’)
– Executing [*71@outbound_office:3] Playback(“SIP/101-000002e4”, “loligo/sounds/extension”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/extension.gsm’ (language ‘en’)
– Executing [*71@outbound_office:4] Read(“SIP/101-000002e4”, “ext,loligo/sounds/then-press-pound”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/then-press-pound.gsm’ (language ‘en’)
> 0x7f7a30927590 – Strict RTP learning complete - Locking on source address 10.1.11.76:4100
– User entered ‘350’
– Executing [*71@outbound_office:5] Authenticate(“SIP/101-000002e4”, “/etc/asterisk/pins.conf,am”) in new stack
– <SIP/101-000002e4> Playing ‘agent-pass.ulaw’ (language ‘en’)
– <SIP/101-000002e4> Playing ‘auth-thankyou.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:6] BackGround(“SIP/101-000002e4”, “loligo/sounds/ent-target-attendant”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/ent-target-attendant.gsm’ (language ‘en’)
– Executing [*71@outbound_office:7] Read(“SIP/101-000002e4”, “toext,loligo/sounds/then-press-pound”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/then-press-pound.gsm’ (language ‘en’)
– User entered ‘494’
– Executing [*71@outbound_office:8] Wait(“SIP/101-000002e4”, “1”) in new stack
Executing [*71@outbound_office:9] Set(“SIP/101-000002e4”, “DB(CF/350=494)”) in new stack <----setting CF in DB----------->
** -
- Executing [*71@outbound_office:10] Playback(“SIP/101-000002e4”, “loligo/sounds/call-fwd-unconditional”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/call-fwd-unconditional.gsm’ (language ‘en’)
– Executing [*71@outbound_office:11] Playback(“SIP/101-000002e4”, “loligo/sounds/for”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/for.gsm’ (language ‘en’)
– Executing [*71@outbound_office:12] Playback(“SIP/101-000002e4”, “loligo/sounds/extension”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/extension.gsm’ (language ‘en’)
– Executing [*71@outbound_office:13] SayDigits(“SIP/101-000002e4”, “350”) in new stack
– <SIP/101-000002e4> Playing ‘digits/3.ulaw’ (language ‘en’)
– <SIP/101-000002e4> Playing ‘digits/5.ulaw’ (language ‘en’)
– <SIP/101-000002e4> Playing ‘digits/0.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:14] Playback(“SIP/101-000002e4”, “loligo/sounds/is-set-to”) in new stack
– <SIP/101-000002e4> Playing ‘loligo/sounds/is-set-to.gsm’ (language ‘en’)
– Executing [*71@outbound_office:15] SayDigits(“SIP/101-000002e4”, “494”) in new stack
– <SIP/101-000002e4> Playing ‘digits/4.ulaw’ (language ‘en’)
– <SIP/101-000002e4> Playing ‘digits/9.ulaw’ (language ‘en’)
– <SIP/101-000002e4> Playing ‘digits/4.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:16] Playback(“SIP/101-000002e4”, “auth-thankyou”) in new stack
– <SIP/101-000002e4> Playing ‘auth-thankyou.ulaw’ (language ‘en’)

--------------------database show from cli-----------------------------
database show
/SIP/Registry/101 : 10.1.11.76:5060:300:101:sip:101@10.1.11.76:5060;ob
/SIP/Registry/135 : 10.1.11.87:5060:300:135:sip:135@10.1.11.87:5060;ob
/SIP/Registry/324 : 10.1.11.198:5060:300:324:sip:324@10.1.11.198:5060;ob
/SIP/Registry/350 : 10.1.11.198:5060:300:350:sip:350@10.1.11.198:5060;ob
/SIP/Registry/352 : 10.1.11.76:5060:300:352:sip:352@10.1.11.76:5060;ob
/SIP/Registry/494 : 10.1.11.87:5060:300:494:sip:494@10.1.11.87:5060;ob

As you can see from the database output, there is no key for CF.

I believe your Set line is incorrect and should instead be the following:

Set(DB(CF/{ext})={toext}));

It looks like the variable names aren’t being dereferenced without the ‘$’:

Executing [*71@outbound_office:1] Answer(“SIP/101-000002e7”, “”) in new stack
> 0x7f7a30927590 – Strict RTP switching to RTP target address 10.1.11.76:4104 as source
– Executing [*71@outbound_office:2] Playback(“SIP/101-000002e7”, “loligo/sounds/please-enter-the”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/please-enter-the.gsm’ (language ‘en’)
– Executing [*71@outbound_office:3] Playback(“SIP/101-000002e7”, “loligo/sounds/extension”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/extension.gsm’ (language ‘en’)
– Executing [*71@outbound_office:4] Read(“SIP/101-000002e7”, “ext,loligo/sounds/then-press-pound”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/then-press-pound.gsm’ (language ‘en’)
> 0x7f7a30927590 – Strict RTP learning complete - Locking on source address 10.1.11.76:4104
– User entered ‘350’
– Executing [*71@outbound_office:5] Authenticate(“SIP/101-000002e7”, “/etc/asterisk/pins.conf,am”) in new stack
– <SIP/101-000002e7> Playing ‘agent-pass.ulaw’ (language ‘en’)
– <SIP/101-000002e7> Playing ‘auth-thankyou.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:6] BackGround(“SIP/101-000002e7”, “loligo/sounds/ent-target-attendant”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/ent-target-attendant.gsm’ (language ‘en’)
– Executing [*71@outbound_office:7] Read(“SIP/101-000002e7”, “toext,loligo/sounds/then-press-pound”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/then-press-pound.gsm’ (language ‘en’)
– User entered ‘135’
– Executing [71@outbound_office:8] Wait(“SIP/101-000002e7”, “1”) in new stack
– Executing [71@outbound_office:9] Set(“SIP/101-000002e7”, “DB(CF/{ext}={toext})”) in new stack

– Executing [*71@outbound_office:10] Playback(“SIP/101-000002e7”, “loligo/sounds/call-fwd-unconditional”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/call-fwd-unconditional.gsm’ (language ‘en’)
– Executing [*71@outbound_office:11] Playback(“SIP/101-000002e7”, “loligo/sounds/for”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/for.gsm’ (language ‘en’)
– Executing [*71@outbound_office:12] Playback(“SIP/101-000002e7”, “loligo/sounds/extension”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/extension.gsm’ (language ‘en’)
– Executing [*71@outbound_office:13] SayDigits(“SIP/101-000002e7”, “350”) in new stack
– <SIP/101-000002e7> Playing ‘digits/3.ulaw’ (language ‘en’)
– <SIP/101-000002e7> Playing ‘digits/5.ulaw’ (language ‘en’)
– <SIP/101-000002e7> Playing ‘digits/0.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:14] Playback(“SIP/101-000002e7”, “loligo/sounds/is-set-to”) in new stack
– <SIP/101-000002e7> Playing ‘loligo/sounds/is-set-to.gsm’ (language ‘en’)
– Executing [*71@outbound_office:15] SayDigits(“SIP/101-000002e7”, “135”) in new stack
– <SIP/101-000002e7> Playing ‘digits/1.ulaw’ (language ‘en’)
– <SIP/101-000002e7> Playing ‘digits/3.ulaw’ (language ‘en’)
– <SIP/101-000002e7> Playing ‘digits/5.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:16] Playback(“SIP/101-000002e7”, “auth-thankyou”) in new stack
– <SIP/101-000002e7> Playing ‘auth-thankyou.ulaw’ (language ‘en’)

Yeah, I don’t know how AEL is supposed to really work either. It’s not commonly used.

I inherited the set up here at my new employer and figuring it out as I go. Is this indeed verification that the CF key should be set in the DB?

– Executing [*71@outbound_office:9] Set(“SIP/101-000002ea”, “DB(CF/350=135)”) in new stack

No, because that string is actually incorrect. It should result in:

DB(CF/350)=135

Which means “set CF/350” to “135”.

Even when I set CF manually, calls don’t forward.

sccprtr-cloneCLI> database put CF 350 324
Updated database successfully
sccprtr-clone
CLI> database show
/CF/350 : 324
/SIP/Registry/101 : 10.1.11.76:5060:300:101:sip:101@10.1.11.76:5060;ob
/SIP/Registry/135 : 10.1.11.87:5060:300:135:sip:135@10.1.11.87:5060;ob
/SIP/Registry/324 : 10.1.11.198:5060:300:324:sip:324@10.1.11.198:5060;ob
/SIP/Registry/350 : 10.1.11.198:5060:300:350:sip:350@10.1.11.198:5060;ob
/SIP/Registry/352 : 10.1.11.76:5060:300:352:sip:352@10.1.11.76:5060;ob
/SIP/Registry/494 : 10.1.11.87:5060:300:494:sip:494@10.1.11.87:5060;ob

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
> 0x7f7a30927590 – Strict RTP learning after remote address set to: 10.1.11.76:4110
– Executing [350@outbound_office:1] Dial(“SIP/101-000002eb”, “SIP/350,30,r,t”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/350
– SIP/350-000002ec is ringing
== Spawn extension (outbound_office, 350, 1) exited non-zero on ‘SIP/101-000002eb’

You would need to show the logic that actually uses the information. Asterisk doesn’t have this built in, it’s written in dialplan just like the original.

Thanks for setting me straight with the string. I’ve fixed that and the CF key is now being set but the calls aren’t forwarding…

– Executing [*71@outbound_office:9] Set(“SIP/101-000002f0”, “DB(CF/350)=135”) in new stack
– Executing [*71@outbound_office:10] Playback(“SIP/101-000002f0”, “loligo/sounds/call-fwd-unconditional”) in new stack
– <SIP/101-000002f0> Playing ‘loligo/sounds/call-fwd-unconditional.gsm’ (language ‘en’)
– Executing [*71@outbound_office:11] Playback(“SIP/101-000002f0”, “loligo/sounds/for”) in new stack
– <SIP/101-000002f0> Playing ‘loligo/sounds/for.gsm’ (language ‘en’)
– Executing [*71@outbound_office:12] Playback(“SIP/101-000002f0”, “loligo/sounds/extension”) in new stack
– <SIP/101-000002f0> Playing ‘loligo/sounds/extension.gsm’ (language ‘en’)
– Executing [*71@outbound_office:13] SayDigits(“SIP/101-000002f0”, “350”) in new stack
– <SIP/101-000002f0> Playing ‘digits/3.ulaw’ (language ‘en’)
– <SIP/101-000002f0> Playing ‘digits/5.ulaw’ (language ‘en’)
– <SIP/101-000002f0> Playing ‘digits/0.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:14] Playback(“SIP/101-000002f0”, “loligo/sounds/is-set-to”) in new stack
– <SIP/101-000002f0> Playing ‘loligo/sounds/is-set-to.gsm’ (language ‘en’)
– Executing [*71@outbound_office:15] SayDigits(“SIP/101-000002f0”, “135”) in new stack
– <SIP/101-000002f0> Playing ‘digits/1.ulaw’ (language ‘en’)
– <SIP/101-000002f0> Playing ‘digits/3.ulaw’ (language ‘en’)
– <SIP/101-000002f0> Playing ‘digits/5.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:16] Playback(“SIP/101-000002f0”, “auth-thankyou”) in new stack
– <SIP/101-000002f0> Playing ‘auth-thankyou.ulaw’ (language ‘en’)
– Executing [*71@outbound_office:17] Hangup(“SIP/101-000002f0”, “”) in new stack
== Spawn extension (outbound_office, *71, 17) exited non-zero on ‘SIP/101-000002f0’

sccprtr-clone*CLI> database show
/CF/350 : 135

sccprtr-clone*CLI> database showkey 350
/CF/350 : 135
/SIP/Registry/350 : 10.1.11.198:5060:300:350:sip:350@10.1.11.198:5060;ob

As I stated in my last response, Asterisk doesn’t have this built in. It’s all logic that is written outside in dialplan or other mechanisms to use the information and do things. You’d have to look at and figure out how things flow and work and where it should be used.

The goal is to allow a user to dial *71 enter their extension, authenticate and then enter a mobile number to forward calls to their extension. This needs to be unconditional at the PBX level because we have users who use soft clients and when the client is closed, the forward goes away. It is my understanding that the CF key is native to asterisk call forwarding and the asterisk software interprets this key as automatic call forwarding. Am I correct in my understanding? Thanks for you patience and help thus far. I’m relatively new to asterisk and being forced into using AEL is an additional level of complexity.

There’s the ability to write an implementation yourself, which is indicated by your original dialplan logic, but that is done by you. Secondly a device can respond back that the call should be forwarded elsewhere - but that is controlled on the phone itself, and Asterisk merely follows where it says. In that case the information is not stored in Asterisk.

My attempted implementation via the dialplan is to set the CF key in the asterisk database to the number or extension set by the user to forward the calls to and take the device out of the mix totally. I visualized asterisk getting a SIP request for an extension, checking the db keys associated with that extension, recognizing that the CF key set and dialing the value of that key instead of the extension. My vision may be flawed but I’ve found no other reference for doing such a thing. So I may be totally off base.

Asterisk itself doesn’t do that. It can be instructed to do so by writing the appropriate dialplan logic.

That’s what I thought I was doing in the highlighted section of the dialplan below. I’m obviously missing an important piece. lol

*71 => {
Answer();
Playback(please-enter-the);
Playback(extension);
Read(ext,then-press-pound);
Authenticate(/etc/asterisk/pins.conf,am);
Background(ent-target-attendant);
Read(toext,then-press-pound);
Wait(1);
Set(DB(CF/{ext}={toext}));
Playback(call-fwd-unconditional);
Playback(for);
Playback(extension);
SayDigits({ext}); Playback(is-set-to); SayDigits({toext});
Playback(auth-thankyou);
Hangup();
};

It now accomplishes the desired goal by setting the key (see below), calls just aren’t forwarded as a result.

– Executing [*71@outbound_office:9] Set(“SIP/101-000002f0”, “DB(CF/350)=135”) in new stack

I am enjoying the learning experience.

That merely sets it. Something else still has to query that in the dialplan, examine it, execute logic to go elsewhere if set.

1 Like

You are only setting the value, you need to check for the value anywhere you dial your endpoints.

1 Like

I think I’m pickin’ up what you guys are layin’ down. I’d have to take something like
exten => s-CF,1,Dial(Local/${CF},30,Ttr) and make it work in AEL and then apply it to each SIP dialplan, correct?

Yeah something like that.

do a DB_EXISTS(${CF}/${EXT}) And if it does then do a Dial(LOCAL/${CF/${EXTEN}@my-outbound-context)