Summary:ASTERISK-02214: [patch] Add ";user=phone" when INVITE contain only phone number
Reporter:fwittekind (fwittekind)Labels:
Date Opened:2004-08-12 14:02:47Date Closed:2008-01-15 15:15:28.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-1.0-RC2-chan_sip-userphone.patch
( 1) userphone.txt
( 2) userphone2.txt
Description:Old description:
add ;user=authname to SIP INVITEs   This was required for making outbound calls to PSTN gw service running Broadworks software.
New description:
For some services, we need to indicate that the user part of the URI we're calling is a phone number by adding ;user=phone to the URI.


From the specs:
"   To accomodate telephone addressing, the SIP specification includes a
  provision to incorporate a tel: URI [4] telephone-subscriber
  (everything following the tel: prefix) directly into the user part of
  a sip: or sips: URI, by setting the "user" parameter to "phone"."
"The tel: URI telephone-subscriber can be either a global-number or a
Comments:By: Olle Johansson (oej) 2004-08-12 14:56:21

Can you explain more, give any references to why the require this? I need more information. user= is normally a hint if this a phone.

Is there any reason to do this by default, as in your patch, or make it an option. Let's do some research on how to do this right! :-)

By: fwittekind (fwittekind) 2004-08-12 16:06:16


Found on page 152, 19.1.3 Example SIP and SIPS URIs

Found on page 222, 25.1 Basic Rules
user-param        =  "user=" ( "phone" / "ip" / other-user)

By: Olle Johansson (oej) 2004-08-12 16:11:40

user=phone is documented in several places, but I can't find anything on user equals something else...

By: Olle Johansson (oej) 2004-08-12 16:17:26

For the record, since this may be useful another time, there's a clarification on "user=phone" in

Still no mention of user=<somethingelse> anywhere except possibly Brian Rosen's proposal for user=dialstring

By: Mark Spencer (markster) 2004-08-12 19:28:55

So what's the story here?  Maybe yet another option?

By: Olle Johansson (oej) 2004-08-13 01:51:03

Markster, we are still trying to find out what the Broadworks stuff requires and the usage of the user= header. As soon as we know more, we'll come up with a proposal. Stay tuned.

My guess is that we can add ";user=phone" when the username really is a phone number or a digit-only extension (DTMF "digit", including *#). We should not add it always, as in the patch.

By: fwittekind (fwittekind) 2004-08-13 13:05:21

";user=phone" is good enough for broadworks to accept.

I uploaded a new version, that only adds ";user=phone" iff the username portion of the SIP URI matches a phone number or a digit-only extension.

Should it also be a option in sip.conf to turn it on or off?

By: Olle Johansson (oej) 2004-08-14 06:54:02

From IETF proceedings:
"  agreed: the presence of the user=phone parameter implies that the user part conforms to the specification of the tel: URI."

Also, some SIP user names are numbers-only without being a tel: uri phone number.

To do this right, this would have to be an option to DIAL. We can however make it an option for a peer, saying that "everything we send to this peer is a phone number, since it's my PSTN gateway (provided that it consists of digits only, and DTMF allowed characters)"

Conclusion: I would add a peer option to your patch, enabling it only for selected peers. Otherwise we could potentially cause problems.

By: Olle Johansson (oej) 2004-08-14 07:54:34

Modified patch
* Allows + as first character according to Tel uri: rfc
* Adds config option for [general] and [peer]
 usereqphone = yes | no

Yes means that *if* the username part is a valid tel uri, we add ;user=phone to the uri before sending it to the proxy. Use this for proxies (pstn providers and gateways) if it's required by the provider.

Fwittekind: Please test and report if this works for you.

By: fwittekind (fwittekind) 2004-08-16 14:02:47

sip debug shows ;user=phone missing from first INVITE packet, yet sip show peer shows UserEqPhone  : Yes

Minor bug fix required, added r->usereqphone = p->usereqphone; to create_addr function.

By: Olle Johansson (oej) 2004-08-16 14:53:30

Great. Added userphone2.txt includes your patch to my patch to your patch, as well as the changes to sip.conf.sample.

Ready for Mark and possibly CVS integration.

Fwittekind: Thank you for working with us to solve this!

By: Mark Spencer (markster) 2004-08-31 15:19:38

Did the recent SIP contact changes help this in any way?

By: Olle Johansson (oej) 2004-08-31 15:21:32

Mark, they're not related.

By: Olle Johansson (oej) 2004-09-05 13:56:23

Mark, find me on the IRC to discuss this patch.

By: Mark Spencer (markster) 2004-10-14 10:49:23

Okay, your turn, you find me!

By: Olle Johansson (oej) 2004-10-15 02:34:17

...will do...

By: twisted (twisted) 2004-10-27 17:16:43

How's the hide-and-seek game going?

By: Olle Johansson (oej) 2004-11-11 15:31:57.000-0600

Ping, Markster. If you need to discuss this more, find me on IRC

By: Olle Johansson (oej) 2004-11-14 02:56:09.000-0600


/O :-)

By: Olle Johansson (oej) 2004-11-21 04:17:08.000-0600

Updated patch to current CVS head

By: Mark Spencer (markster) 2004-12-02 18:31:05.000-0600

Added to CVS, thanks olle!

By: Russell Bryant (russell) 2004-12-02 19:13:39.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:15:28.000-0600

Repository: asterisk
Revision: 4372

U   trunk/channels/chan_sip.c
U   trunk/configs/sip.conf.sample

r4372 | markster | 2008-01-15 15:15:28 -0600 (Tue, 15 Jan 2008) | 2 lines

Add user=phone option (bug ASTERISK-2214, thanks oej)