;;;===================================================================
;;; ABNF for RFC 2806, "URLs for Telephone Calls"
;;; See http://tools.ietf.org/html/rfc2806
;;;===================================================================

telephone-url         = telephone-scheme ":"
                        telephone-subscriber

telephone-scheme      = "tel"

telephone-subscriber  = global-phone-number / local-phone-number

global-phone-number   = "+" base-phone-number [isdn-subaddress]
                        [post-dial] *(area-specifier /
                        service-provider / future-extension)

base-phone-number     = 1*phonedigit

local-phone-number    = 1*(phonedigit / dtmf-digit /
                        pause-character) [isdn-subaddress]
                        [post-dial] area-specifier
                        *(area-specifier / service-provider /
                        future-extension)

isdn-subaddress       = ";isub=" 1*phonedigit

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

area-specifier        = ";" phone-context-tag "=" phone-context-ident

phone-context-tag     = "phone-context"

phone-context-ident   = network-prefix / private-prefix

network-prefix        = global-network-prefix / local-network-prefix

global-network-prefix = "+" 1*phonedigit

local-network-prefix  = 1*(phonedigit / dtmf-digit / pause-character)

private-prefix        = (%x21-22 / %x24-27 / %x2C / %x2F / %x3A /
                        %x3C-40 / %x45-4F / %x51-56 / %x58-60 /
                        %x65-6F / %x71-76 / %x78-7E)
                        *(%x21-3A / %x3C-7E)
                        ; Characters in URLs must follow escaping rules
                        ; as explained in [RFC2396]
                        ; See sections 1.2 and 2.5.2

service-provider      = ";" provider-tag "=" provider-hostname

provider-tag          = "tsp"

provider-hostname     = domain ; <domain> is defined in [RFC1035]
                        ; See section 2.5.10

future-extension      = ";" 1*(token-char) ["=" ((1*(token-char)
                        ["?" 1*(token-char)]) / quoted-string )]
                        ; See section 2.5.11 and [RFC2543]

token-char            = (%x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39
                        / %x41-5A / %x5E-7A / %x7C / %x7E)
                        ; Characters in URLs must follow escaping rules
                        ; as explained in [RFC2396]
                        ; See sections 1.2 and 2.5.11

quoted-string         = %x22 *( "\" CHAR / (%x20-21 / %x23-7E
                        / %x80-FF )) %x22
                        ; Characters in URLs must follow escaping rules
                        ; as explained in [RFC2396]
                        ; See sections 1.2 and 2.5.11

phonedigit            = DIGIT / visual-separator

visual-separator      = "-" / "." / "(" / ")"

pause-character       = one-second-pause / wait-for-dial-tone

one-second-pause      = "p"

wait-for-dial-tone    = "w"

dtmf-digit            = "*" / "#" / "A" / "B" / "C" / "D"



fax-url          = fax-scheme ":" fax-subscriber

fax-scheme       = "fax"

fax-subscriber   = fax-global-phone / fax-local-phone

fax-global-phone = "+" base-phone-number [isdn-subaddress]
                   [t33-subaddress] [post-dial]
                   *(area-specifier / service-provider /
                   future-extension)

fax-local-phone  = 1*(phonedigit / dtmf-digit /
                   pause-character) [isdn-subaddress]
                   [t33-subaddress] [post-dial]
                   area-specifier
                   *(area-specifier / service-provider /
                   future-extension)

t33-subaddress   = ";tsub=" 1*phonedigit

modem-url          = modem-scheme ":" remote-host

modem-scheme       = "modem"

remote-host        = telephone-subscriber *(modem-params
                     / recommended-params)

modem-params       = ";type=" data-capabilities

recommended-params = ";rec=" data-capabilities

data-capabilities  = accepted-modem ["?" data-bits parity
                     stop-bits]

accepted-modem     = "V21" / "V22" / "V22b" /
                     "V23" / "V26t" / "V32" /
                     "V32b" / "V34" / "V90" /
                     "V110" / "V120" / "B103" /
                     "B212" / "X75" /
                     "vnd." vendor-name "." modem-type

data-bits          = "7" / "8"

parity             = "n" / "e" / "o" / "m" / "s"

stop-bits          = "1" / "2"

vendor-name        = 1*(ALPHA / DIGIT / "-" / "+")

modem-type         = 1*(ALPHA / DIGIT / "-" / "+")
