How do I give option to dial an extension in Tel:

2019-02-28 03:22发布

问题:

While putting a tel link as <a href="tel:+91123456789,,123">Dial</a> and clicking it from a mobile browser, only initial number gets transferred to dialer and not the commas or extension. I've tried p, w and ;ext= as well but nothing is working. p and w change to '7' and '9' respectively.

Tested using Moto X 1st Gen.

回答1:

According to the documentation, the tel: scheme supports RFC 3966. Reading these RFCs is a bit like reading cuneiform on clay tablets, but from what I can tell, your syntax is not part of that standard. It looks like you would want tel:+91123456789;ext=123.

UPDATE: Something you can consider since tel:+91123456789;ext=123 only works for less than 4.0 and tel:+91123456789,123 works for 4.0+ would be to check the user agent and put out the appropriate one.

<a href="tel:+91123456789;ext=123">Dial</a> //Less than 4.0
<a href="tel:+91123456789,123">Dial</a>     //Greater than 4.0

Source: Problems using extensions in tel: hyperlinks on Android 4



回答2:

The latest version of this is RFC 3966 which says you need to use ;ext= at the end:

extension = ";ext=" 1*phonedigit

Phone extensions identify stations behind a non-ISDN PBX and are functionally roughly equivalent to ISDN subaddresses. They are identified with the 'extension' parameter.

You say you have tried this tho, so it may be that your browser only supports the older obsolete RFC 2806, which RFC 3966 replaces.

For this older RFC, it looks like you need to set a post-dial sequence, using ;postd=:

post-dial = ";postd=" 1*(phonedigit / dtmf-digit / pause-character)

Phone numbers can also contain a post-dial sequence. This is what is often used with voice mailboxes and other services that are controlled by dialing numbers from your phone keypad while the call is in progress.