[asterisk-dev] [patch] adding username from registration to peer state ?

Luigi Rizzo rizzo at icir.org
Fri Oct 27 02:31:30 MST 2006


On Fri, Oct 27, 2006 at 10:31:40AM +0200, Johansson Olle E wrote:
> inbound or outbound registrations?

inbound

> The Contact is certainly saved, and that's the interesting part.
> Why should the From header be interesting?

because it does not seem to carry the name. E.g. my HT286 does this
(addresses replaced with x.x.x.x). As you see, the Contact: has
nothing useful, and the name is in the From: field.

    <--- SIP read from x.x.x.x:29848 --->
    REGISTER sip:x.x.x.x SIP/2.0
    Via: SIP/2.0/UDP x.x.x.x:29848;branch=z9hG4bK4b52818f0289e5fa
    From: "Luigi Rizzo" <sip:551 at x.x.x.x;user=phone>;tag=e53fab7c73f81a0c
    To: <sip:551 at x.x.x.x;user=phone>
    Contact: *
    Authorization: Digest username="551", realm="asterisk", algorithm=MD5, uri="sip:x.x.x.x",
     nonce="685e0eaf", response="02337a48000659702170c5b0128f4e52"
    Call-ID: 6432fb03ade62578 at x.x.x.x
    CSeq: 101 REGISTER
    Expires: 0
    User-Agent: Grandstream HT286 1.0.6.7
    Max-Forwards: 70
    Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE
    Content-Length: 0

cheers
luigi

> 27 okt 2006 kl. 07.58 skrev Luigi Rizzo:
> 
> > Any interest in adding the username from the REGISTER message
> > in the stored peer state ? It seems that we currently do not
> > learn this information, which is a useful one to display on a GUI.
> >
> > Implementation is trivial (see the attached patch), i am only
> > uncertain on what is the appropriate field name to use for the
> > manager messages...
> >
> > 	cheers
> > 	luigi
> >
> > Index: channels/chan_sip.c
> > ===================================================================
> > --- channels/chan_sip.c	(revision 46348)
> > +++ channels/chan_sip.c	(working copy)
> > @@ -1073,6 +1073,7 @@
> >  	char mohinterpret[MAX_MUSICCLASS];/*!<  Music on Hold class */
> >  	char mohsuggest[MAX_MUSICCLASS];/*!<  Music on Hold class */
> >  	char useragent[256];		/*!<  User agent in SIP request (saved from  
> > registration) */
> > +	char from_header[256];		/*!<  From header in registration */
> >  	struct ast_codec_pref prefs;	/*!<  codec prefs */
> >  	int lastmsgssent;
> >  	time_t	lastmsgcheck;		/*!<  Last time we checked for MWI */
> > @@ -7748,6 +7750,10 @@
> >  		if (option_verbose > 3)
> >  			ast_verbose(VERBOSE_PREFIX_3 "Saved useragent \"%s\" for peer %s 
> > \n", peer->useragent, peer->name);
> >  	}
> > +	{ const char *from = get_header(req, "From");
> > +		if (!ast_strlen_zero(from))
> > +			get_calleridname(from, peer->from_header, sizeof(peer- 
> > >from_header));
> > +	}
> >  	return PARSE_REGISTER_UPDATE;
> >  }
> >
> > @@ -9612,6 +9623,7 @@
> >  			"VideoSupport: %s\r\n"
> >  			"ACL: %s\r\n"
> >  			"Status: %s\r\n"
> > +			"From: %s\r\n"
> >  			"RealtimeDevice: %s\r\n\r\n",
> >  			idtext,
> >  			iterator->name,
> > @@ -9622,6 +9634,7 @@
> >  			ast_test_flag(&iterator->flags[1], SIP_PAGE2_VIDEOSUPPORT) ?  
> > "yes" : "no",	/* VIDEOSUPPORT=yes? */
> >  			iterator->ha ? "yes" : "no",       /* permit/deny */
> >  			status,
> > +			iterator->from_header,
> >  			realtimepeers ? (ast_test_flag(&iterator->flags[0],  
> > SIP_REALTIME) ? "yes":"no") : "no");
> >  		}
> >
> > _______________________________________________
> > --Bandwidth and Colocation provided by Easynews.com --
> >
> > asterisk-dev mailing list
> > To UNSUBSCRIBE or update options visit:
> >    http://lists.digium.com/mailman/listinfo/asterisk-dev
> 
> ---
> Olle E. Johansson * Asterisk Evangelist, developer * VOOP A/S
> olle at voop.com
> 
> 
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev


More information about the asterisk-dev mailing list