[asterisk-dev] [svn-commits] oej: trunk r172818 - /trunk/channels/chan_sip.c

Mark Michelson mmichelson at digium.com
Mon Feb 2 09:35:43 CST 2009


SVN commits to the Digium repositories wrote:
> Author: oej
> Date: Mon Feb  2 04:46:19 2009
> New Revision: 172818
> 
> URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172818
> Log:
> Add a todo. I do need to really check what's going on with this kill-the-user business ;-)
> Why do we suddenly have two flags to set peer type?
> 
> Modified:
>     trunk/channels/chan_sip.c
> 
> Modified: trunk/channels/chan_sip.c
> URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=172818&r1=172817&r2=172818
> ==============================================================================
> --- trunk/channels/chan_sip.c (original)
> +++ trunk/channels/chan_sip.c Mon Feb  2 04:46:19 2009
> @@ -1864,7 +1864,6 @@
>  	char rt_fromcontact;		/*!< copy fromcontact from realtime */
>  	char host_dynamic;		/*!< Dynamic Peers register with Asterisk */
>  	char selfdestruct;		/*!< Automatic peers need to destruct themselves */
> -	char onlymatchonip;		/*!< Only match on IP for incoming calls (old type=peer) */
>  	char the_mark;			/*!< moved out of ASTOBJ into struct proper; That which bears the_mark should be deleted! */
>  
>  	int expire;			/*!<  When to expire this peer registration */
> @@ -1896,7 +1895,10 @@
>  	int timer_t1;			/*!<  The maximum T1 value for the peer */
>  	int timer_b;			/*!<  The maximum timer B (transaction timeouts) */
>  	int deprecated_username; /*!< If it's a realtime peer, are they using the deprecated "username" instead of "defaultuser" */
> +	
> +	/*XXX Seems like we suddenly have two flags with the same content. Why? To be continued... */
>  	enum sip_peer_type type; /*!< Distinguish between "user" and "peer" types. This is used solely for CLI and manager commands */
> +	char onlymatchonip;		/*!< Only match on IP for incoming calls (old type=peer) */
>  };
>  

This additional field was my doing. It had to do with the fact that the 
kill-the-user changes also killed the CLI command to show users. I first 
re-added the commands using the onlymatchonip field to tell if a sip_pvt was a 
user or not.

The problem with this is that both users and friends have onlymatchonip set to 
FALSE, while peers have onlymatchonip set to TRUE. Since friend entries should 
show up in both "sip show users" and "sip show peers," it meant that I could not 
use the onlymatchonip field to list a friend when someone tried to run "sip show 
peers." I came up with the type field and only use it to make sure the output is 
correct in CLI commands. The comment next to the field says this, but it should 
probably be expanded on to explain why it's needed and onlymatchonip is not 
sufficient for such scenarios. Would such a correction be sufficient?

Mark Michelson



More information about the asterisk-dev mailing list