[Home]

Summary:ASTERISK-13606: [patch] Allow app_dial to provide 'tone while ringing' like 'option m' which will provide 'music on hold while dialling'
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2009-02-19 05:23:36.000-0600Date Closed:2010-01-06 14:10:43.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_dial.play_ring_indications.diff5.txt
( 1) app_dial.play_ring_indications.diff7.txt
Description:Application is to allow asterisk to be an ISDN providered to attempt delivery of calls over Cellular Trunks connected to asterisk, if it cannot deliver the call then signal CONGESTION to the calling party switch, who will then respond appropriately by delivering the call out over its PSTN connection.

Currently this can be achived, with option 'm([classs])' in the dial command, which will indicate PROGRESS to the calling party and provide moh. But it's just not right to play music as a ring tone.

option 'r' from app_dial indicates 'RINGING' to the calling party, which is fine if you don't then what to indicate CONGESTION.  Because the calling party's switch already believes asterisk can deliver the call, it won't try an alternative.

The patch I have provided doesn't change the default functionality of option 'r' but adds to it.
Like option 'm', which will play a 'class' of music as defined in musiconhold.conf, option 'r' will play a 'tone' as defined in indications.conf, it will also indicate PROGRESS to the calling party if a tone is defined, otherwise it will still indicate RINGING.

****** ADDITIONAL INFORMATION ******

sample dialplan code

exten => s,n,Dial(${CELLTRUNK}/${number}#,,r(ring))
exten => s,n,Congestion(0)
Comments:By: Jared Smith (jsmith) 2009-02-19 08:59:02.000-0600

I haven't take the time to try your patch yet (it's been a busy morning), but I was thinking about this same sort of thing just yesterday... wouldn't it be nice to be able to "personalize" the ringback tones with indications instead of hold music.

I like the idea!

By: Alec Davis (alecdavis) 2009-02-20 01:34:11.000-0600

Installed on main server last night, 1 full business day of calls has now passed, not 1 problem or complaint, other than comments that it's much better now that there isn't silence for long periods.

jsmith: I had a play with different cadences in the indications.conf file, but at the end of the day, I can see I'll confuse users, they won't recognise the different ring tones, but it was fun.

Others: Show your interest for this by clicking the "Monitor Issue" button.

By: Alec Davis (alecdavis) 2009-02-24 05:43:24.000-0600

please remove app_dial.send_tone.diff.txt does not compile on latest trunk.

uploaded app_dial.send_tone.diff2.txt
Further testing revealed that when the called channel has signalled 'ringing' that the custom ringback tone would stop, the caller would hear standard ringback tone.

Now the caller hears custom ringback tone until the called party signals 'answered', then of course normal voice path is heard.

By: Alec Davis (alecdavis) 2009-02-25 04:47:20.000-0600

uploaded app_dial.send_tone.diff3.txt

now includes option 'R' from http://bugs.digium.com/view.php?id=10934

option 'r(ring)' works very well for us. We don't have any dead air, while asterisk and devices attempt various call setups.

The above option may look silly, why use 'r(ring)', well we don't, it was an example we actually use a custom ring cadence setup in indications.conf called 'vodaring' with syntax being;
exten => s,n,Dial(${CELLTRUNK}/${number}#,,r(vodaring))

By: Alec Davis (alecdavis) 2009-02-27 11:44:07.000-0600

Now has been instlled for a week, using option 'r(vodaring)' and handled around 300 cell calls. No system crashes.

Others please provide feedback on how it working for you.

And for fun I added the following to indications.conf

starwars_theme = 262/400,392/500,0/100,349/400,330/400,294/400,524/400,392/500,0/100,349/400,330/400,294/400,524/400,392/500,0/100,349/400,330/400,349/400,294/500,0/2000

then played with exten => s,n,Dial(${TRUNK}/${number}#,,r(starwars_theme))

By: Leif Madsen (lmadsen) 2009-02-27 12:11:00.000-0600

Very cool! I hope this gets in soon :)

By: Alec Davis (alecdavis) 2009-03-16 15:30:40

No feedback; could mean all must all be good :)

If you have tested this, and it worked for you please provide feedback.

By: Alec Davis (alecdavis) 2009-04-29 03:44:07

Bump. Maybe in the next major release.

using
exten => s,n,Dial(${CELLTRUNK}/${number}#,,r(vodaring))

Has now been working flawlessly since February in production in 2 sites.

By: Leif Madsen (lmadsen) 2009-05-04 08:11:18

Assigned to Tilghman for code review.

By: Tilghman Lesher (tilghman) 2009-05-04 15:26:03

Since we are running out of Dial command options, I'd prefer that instead of using the 'R' option, especially these are so close in functionality, that you instead make the argument to the 'r' option take an optional second parameter, such as:

Dial(...,30,r(ring,e))

such that the optional second parameter 'e' to the 'r' option specifies whether to interrupt the indication with early media or not.  Also, it would be helpful to note that 'ring' is the default for the first parameter.

By: Alec Davis (alecdavis) 2009-05-07 05:22:47

Dropped option 'R' Early Media which I highjacked from http://bugs.digium.com/view.php?id=10934, I may get that bug report reopened for replacement of option 'R', but need to understand it a bit better, and be able to test.

Now regarding the original intention of this patch. It now compiles and tested with latest trunk downloaded a few nights ago.

From a DAHDI connected phone it still works as expected. See console output below. The appropriate 'indications tone' is played.

   -- Starting simple switch on 'DAHDI/33-1'
   -- Hungup 'DAHDI/33-1'
   -- Starting simple switch on 'DAHDI/33-1'
[May  7 21:53:16] WARNING[21708]: chan_dahdi.c:2706 dahdi_enable_ec: Unable to enable echo cancellation on channel 33 (No such device)
   -- Executing [2345@phones:1] Dial("DAHDI/33-1", "DAHDI/32,20,r(starwars_theme)t") in new stack
   -- Called 32
   -- DAHDI/32-1 is ringing
   -- DAHDI/32-1 is ringing
   -- DAHDI/32-1 is ringing
   -- DAHDI/32-1 is ringing
   -- DAHDI/32-1 is ringing
   -- Hungup 'DAHDI/32-1'
 == Spawn extension (phones, 2345, 1) exited non-zero on 'DAHDI/33-1'
   -- Hungup 'DAHDI/33-1'
   -- Starting simple switch on 'DAHDI/33-1'

But from a sip connected phone console output is filled with WARNING below,

 -- Executing [237@trusted:1] Dial("SIP/820-09b24d70", "SIP/alechome,,r(vodaring)") in new stack
   -- Called alechome
   -- SIP/alechome-09b20b60 is ringing
[May  7 22:07:43] WARNING[14412]: chan_sip.c:5922 sip_write: Asked to transmit frame type 64, while native formats is 0x8 (alaw)(8) read/write = 0x8 (alaw)(8)/0x8 (alaw)(8)
[May  7 22:07:43] WARNING[14412]: chan_sip.c:5922 sip_write: Asked to transmit frame type 64, while native formats is 0x8 (alaw)(8) read/write = 0x8 (alaw)(8)/0x8 (alaw)(8)
....

This is the same warning message as http://bugs.digium.com/view.php?id=14249 and http://bugs.digium.com/view.php?id=14310.

Previously (and still on our production boxes) a SIP device would give you the correct 'indications tone'.
No different phones give different symptoms, same warning as above, but a CISCO 7912 gives normal ring tone, and a Grandstream GXP2000 there is no ringing heard.



By: Leif Madsen (lmadsen) 2009-05-07 07:49:08

Setting to confirmed and un-assigning myself from this issue.

By: Alec Davis (alecdavis) 2009-05-07 16:28:12

Any one able to help with the new warning, that now reliably occurs with this code, and was problem for other users refering to bugs 14249 and 14310.

May 7 22:07:43] WARNING[14412]: chan_sip.c:5922 sip_write: Asked to transmit frame type 64, while native formats is 0x8 (alaw)(8) read/write = 0x8 (alaw)(8)/0x8 (alaw)(8)

By: Alec Davis (alecdavis) 2009-06-26 07:03:20

uploaded app_dial.play_ring_indications.diff2.txt
Updated to apply clean to trunk.

Dahdi calls work fine.

Opened separate bug https://issues.asterisk.org/view.php?id=15405 to address the SIP 'frame type' problem.



By: Alec Davis (alecdavis) 2009-06-27 21:05:22

uploaded app_dial.play_ring_indications.diff3.txt

Sorted out sip write problem. Forgot to set the write format.

Please remove:
 app_dial.play_ring_indications.diff.txt
 app_dial.play_ring_indications.diff2.txt

edit: The fixup for the 'sip write' makes it work, correct or not.
Further debug has found that the early 'make_compatible???' in app_dial/wait_for_answer being executed before the call is answered is triggering the problem.
Type 64 is SLINEAR, which playtones sets.

The issue I have with make_compatible is why so early? After all, the caller's SIP phone is only communicating with Asterisk at this stage, it doesn't need to be compatible with the called device yet.

Further work to do, or some to standup and say, 'I know'...



By: Alec Davis (alecdavis) 2009-12-15 04:15:52.000-0600

please remove
 app_dial.play_ring_indications.diff.txt
 app_dial.play_ring_indications.diff2.txt
 app_dial.play_ring_indications.diff3.txt

for trunk:
uploaded app_dial.play_ring_indications.diff4.txt

works again, removed fixup for 'sip write' that was wrong.

<b><u>dialplan:</u></b>
exten => 8689,1,Progress()
exten => 8689,n,Dial(${TRUNK}/1234,,r(starwars_theme))

<b><u>/etc/asterisk/indications.conf</u></b>

[general]
country=nz

[nz]
vodaring = 400+450/400,0/200,400+450/200,0/200,400+450/400,0/2000
starwars_theme = 262/400,392/500,0/100,349/400,330/400,294/400,524/400,392/500,0/100,349/400,330/400,294/400,524/400,392/500,0/100,349/400,330/400,349/400,294/500,0/2000



By: Alec Davis (alecdavis) 2009-12-15 04:18:54.000-0600

This is now like app Read and app ReadExten, that now support playout of a tone from indications.conf

Please feedback.

By: Leif Madsen (lmadsen) 2009-12-15 07:25:22.000-0600

At this point I might suggest you post this to the reviewboard to try and get some reviews from the community. It seems like you're pretty close to getting this complete now, however asking for reviews just on here is probably not going to end up producing much fruit.

By: Jared Smith (jsmith) 2009-12-15 11:03:06.000-0600

I tried out the patch, but didn't get any ringback tone at all.  (I'm trying with chan_local, but can't see how that might affect the problem.)

[lab]
exten => 123,1,Dial(Local/124@lab,,r(starwars_theme))
exten => 124,1,Progress()
exten => 124,2,Wait(30)
exten => 124,3,Goto(2)

When I dial extension 123 in the lab context, I get the following:

   -- Executing [123@lab:1] Dial("SIP/polycom-00000003", "Local/124@lab,,r(starwars_theme)") in new stack
   -- Called 124@lab
   -- Executing [124@lab:1] NoOp("Local/124@lab-c77b;2", "") in new stack
   -- Executing [124@lab:2] Wait("Local/124@lab-c77b;2", "30") in new stack
[Dec 15 11:01:58] WARNING[20848]: chan_sip.c:6550 sip_write: Asked to transmit frame type slin, while native formats is 0x4 (ulaw) read/write = 0x4 (ulaw)/0x4 (ulaw)
[Dec 15 11:01:58] WARNING[20848]: chan_sip.c:6550 sip_write: Asked to transmit frame type slin, while native formats is 0x4 (ulaw) read/write = 0x4 (ulaw)/0x4 (ulaw)
[Dec 15 11:01:58] WARNING[20848]: chan_sip.c:6550 sip_write: Asked to transmit frame type slin, while native formats is 0x4 (ulaw) read/write = 0x4 (ulaw)/0x4 (ulaw)
[Dec 15 11:01:58] WARNING[20848]: chan_sip.c:6550 sip_write: Asked to transmit frame type slin, while native formats is 0x4 (ulaw) read/write = 0x4 (ulaw)/0x4 (ulaw)

and I get *hundreds* of those WARNINGs scrolling across my console.

By: Jared Smith (jsmith) 2009-12-15 11:06:04.000-0600

Just to clarify, I *did* in fact test to make sure that the indications themselves were working, by using the following extension:

exten => 122,1,Progress()
exten => 122,n,Playtones(starwars_theme)
exten => 122,n,Wait(30)
exten => 122,n,Stoptones(starwars_theme)
exten => 122,n,Playback(goodbye)
exten => 122,n,Hangup()

By: Alec Davis (alecdavis) 2009-12-16 04:08:31.000-0600

uploaded app_dial.play_ring_indications.diff5.txt

I was nearly there in note ~107104, 6 months ago, argh!

To stop these write errors, don't make the channels compatible if Asterisk is providing ringback or musicback. They are made compatible after the channel is answered.

dialplan code one of below:
exten => 80,1,Dial(DAHDI/2,,r(starwars_theme))
exten => 80,1,Dial(DAHDI/2,,r)
exten => 80,1,Dial(DAHDI/2,,m)
exten => 80,1,Dial(DAHDI/2,,)

console outputs below: with a debug print in ast_channel_make_compatible

<u>Test 1: With <b>'r(starwars_theme)'</b> - custom ringback tone from indications.conf</u>
 -- Executing [80@phones:1] Dial("SIP/cisco4-00000002", "DAHDI/2,,r(starwars_theme)") in new stack
   -- Called 2
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 answered SIP/cisco4-00000002
[Dec 16 22:58:17] WARNING[28948]: channel.c:4743 ast_channel_make_compatible: ALEC ast_channel_make_compatible from 'SIP/cisco4-00000002' to 'DAHDI/2-1'
   -- Hanging up on 'DAHDI/2-1'
   -- Hungup 'DAHDI/2-1'

<u>Test 2: With <b>'r'</b> option - ringback tone</u>
  -- Executing [80@phones:1] Dial("SIP/cisco4-00000003", "DAHDI/2,,r") in new stack
   -- Called 2
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 answered SIP/cisco4-00000003
[Dec 16 23:00:38] WARNING[28974]: channel.c:4743 ast_channel_make_compatible: ALEC ast_channel_make_compatible from 'SIP/cisco4-00000003' to 'DAHDI/2-1'
   -- Hanging up on 'DAHDI/2-1'

<u>Test 3: With <b>'m'</b> option - default musicback</u>
  -- Executing [80@phones:1] Dial("SIP/cisco4-00000004", "DAHDI/2,,m") in new stack
   -- Called 2
   -- Started music on hold, class 'default', on SIP/cisco4-00000004
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 answered SIP/cisco4-00000004
   -- Stopped music on hold on SIP/cisco4-00000004
[Dec 16 23:03:10] WARNING[28989]: channel.c:4743 ast_channel_make_compatible: ALEC ast_channel_make_compatible from 'SIP/cisco4-00000004' to 'DAHDI/2-1'
   -- Hanging up on 'DAHDI/2-1'
   -- Hungup 'DAHDI/2-1'

<u>Test 4: No <b>'r' or 'b'</b> options - no ringback, no musicback</u>
   -- Executing [80@phones:1] Dial("SIP/cisco4-00000005", "DAHDI/2") in new stack
   -- Called 2
[Dec 16 23:06:33] WARNING[29019]: channel.c:4743 ast_channel_make_compatible: ALEC ast_channel_make_compatible from 'DAHDI/2-1' to 'SIP/cisco4-00000005'
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/2-1 answered SIP/cisco4-00000005
[Dec 16 23:06:36] WARNING[29019]: channel.c:4743 ast_channel_make_compatible: ALEC ast_channel_make_compatible from 'SIP/cisco4-00000005' to 'DAHDI/2-1'
   -- Hanging up on 'DAHDI/2-1'



By: Alec Davis (alecdavis) 2009-12-16 05:00:14.000-0600

reviewboard link https://reviewboard.asterisk.org/r/448/

By: Jared Smith (jsmith) 2009-12-16 05:57:58.000-0600

Thanks Alec... Patch number five worked much better for me!

-Jared

By: Alec Davis (alecdavis) 2009-12-16 11:18:12.000-0600

please remove the following 3 files
app_dial.play_ring_indications.diff2.txt
app_dial.play_ring_indications.diff3.txt
app_dial.play_ring_indications.diff4.txt

By: Tilghman Lesher (tilghman) 2009-12-16 12:08:20.000-0600

One of the differences that you indicated on the mailing list between m() and r() was that m() provided Progress, while r() provided ringing, and that you could change from Progress to Congestion, but not Ringing to Congestion.  Would it make sense to you to allow the r() option to take a second parameter, which allowed it to also provide Progress instead of Ringing?

By: Alec Davis (alecdavis) 2009-12-17 03:35:26.000-0600

I think I understand you question.

The first option for option 'r' is the indication tone file, like below.
Dial(DAHDI/g0/,,r(indicationtone))
which currently will, like musicback, send Progress.

I think your suggesting a second option, which may look like
Dial(DAHDI/g0/,,r(indicationtone:ringing))
Dial(DAHDI/g0/,,r(indicationtone:progress))
Dial(DAHDI/g0/,,r(indicationtone:proceeding)) ????

And the default would be to send a Ringing Indication.
Dial(DAHDI/g0/,,r(indicationtone))

And the 'm' music option, that requires a second option?
Defaulting to Progress, but able to be overridden with Ringing or Proceeding.

By: Tilghman Lesher (tilghman) 2009-12-17 08:51:28.000-0600

That is precisely the suggestion.  I would go with syntactic changes of using the comma as a delimiter, but you have the idea down pat.

By: Alec Davis (alecdavis) 2009-12-19 02:54:32.000-0600

please remove app_dial.play_ring_indications.diff5.txt
uploaded app_dial.play_ring_indications.diff7.txt

Includes corrections from reviewboard.

By: Digium Subversion (svnbot) 2009-12-19 02:59:32.000-0600

Repository: asterisk
Revision: 235740

U   trunk/CHANGES
U   trunk/apps/app_dial.c

------------------------------------------------------------------------
r235740 | alecdavis | 2009-12-19 02:59:31 -0600 (Sat, 19 Dec 2009) | 9 lines

app_dial optional parameter to option 'r' to allow play indication from indications.conf

 (closes issue ASTERISK-13606)
 Reported by: alecdavis
 Tested by: alecdavis,jsmith
 Patch
app_dial.play_ring_indications.diff7.txt uploaded by alecdavis (license 585)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=235740