Alexey Trizno wrote:
> When remote party send DTMF, local party receive SIPX_MEDIA_INFO with 
> _numeric_ toneId (0x02 for '2', 0x0A for '*', 0x0B for '#', etc.), but 
> SIPX_TONE_ID structure describes ID_DTMF_2 = '2' (char) for 2.
>
>     ID_DTMF_INVALID        = 0,     /**< Invalid/Uninitialized DMTF Id */
>     ID_DTMF_0              = '0',   /**< DMTF 0 */
>     ID_DTMF_1              = '1',   /**< DMTF 1 */
>     ID_DTMF_2              = '2',   /**< DMTF 2 */
>     ID_DTMF_3              = '3',   /**< DMTF 3 */
>     ID_DTMF_4              = '4',   /**< DMTF 4 */
>     ID_DTMF_5              = '5',   /**< DMTF 5 */
>     ID_DTMF_6              = '6',   /**< DMTF 6 */
>     ID_DTMF_7              = '7',   /**< DMTF 7 */
>     ID_DTMF_8              = '8',   /**< DMTF 8 */
>     ID_DTMF_9              = '9',   /**< DMTF 9 */
>     ID_DTMF_STAR           = '*',   /**< DMTF * */
>     ID_DTMF_POUND          = '#',   /**< DMTF # */
>     ID_DTMF_FLASH          = '!',   /**< DTMF Flash */
>
> Thus when remote party send 0, we receive toneId = ID_DTMF_INVALID
>
>   
These Ids are used for sending DTMF in sipxtapi.
These Ids make their way into dtmflib.cpp into void 
MpToneGen_startTone(MpToneGenPtr p, int toneID)

case '1': case  1 : pNew = &(p->key1); break;
            case '2': case  2 : pNew = &(p->key2); break;
            case '3': case  3 : pNew = &(p->key3); break;
            case 'a': case 'A': pNew = &(p->keya); break;
            case '4': case  4 : pNew = &(p->key4); break;
            case '5': case  5 : pNew = &(p->key5); break;
            case '6': case  6 : pNew = &(p->key6); break;
            case 'b': case 'B': pNew = &(p->keyb); break;
            case '7': case  7 : pNew = &(p->key7); break;
            case '8': case  8 : pNew = &(p->key8); break;
            case '9': case  9 : pNew = &(p->key9); break;
            case 'c': case 'C': pNew = &(p->keyc); break;
            case '*':           pNew = &(p->keystar); break;
            case '0': case  0 : pNew = &(p->key0); break;
            case '#':           pNew = &(p->keysharp); break;
            case 'd': case 'D': pNew = &(p->keyd); break;

As you can see, the code can handle both '1' and 1 when sending. But 
when firing the event io sipxtapi upon dtmf reception, the ID is not 
converted to internal sipxtapi ID properly. In sipxtapi there is 
function sipxTranslateToneId when sending DTMF, maybe a similar function 
could be used to do reverse translation.

I found out why I didn't receive DTMF via INFO in sipxtapi, my voip 
provider doesn't support it it seems, it responds with 415 Unsupported 
media type :(
when I use sjphone.

The solution could be to get rid of ID_DTMF_INVALID (visual assist says 
its not used anywhere), and replace all '1' etc with their codes:

 0--9                0--9
 *                     10
 #                     11
 A--D              12--15
 Flash                 16

in SIPX_TONE_ID

Also clean up the switch in MpToneGen_startTone to get rid of '1' etc 
and leave the numbers only. After these changes we could get rid of 
sipxTranslateToneId in sipxtapiinternal.cpp as with VOICE_ENGINE we 
would use the same IDs.

But alexander chemeris or dan petrie must agree with this solution.

Jaroslav Libak

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to