[asterisk-dev] implementation suggestion
Mark Michelson
mmichelson at digium.com
Mon Sep 22 09:32:58 CDT 2008
Klaus Darilion wrote:
>
> Kevin P. Fleming schrieb:
>> Klaus Darilion wrote:
>>
>>> I started thinking about how to implement this feature. What about:
>>>
>>> 1. Define a channel data store "SIPopts".
>>> 2. On incoming SIP calls, the SIPopts channel data store is created, the
>>> member maxfwd is set to the value of the incoming Max-Forwards Header
>>> and the channel data store will be linked to the incoming channel as
>>> "global".
>>> 3. Dial() applikation will copy ghe globel data store to all outgoing
>>> channels.
>>> 4. If the outgoing channel is a SIP channel, chan_sip will check if the
>>> destination (peer) has set decmaxfwd==true and if yes, it will set
>>> Max-Forwards to the value in the data store minus 1 instead of using 70.
>>>
>>> What do you think about this?
>> Well, I would suggest making the variable and config option names a bit
>> more expressive (no need for such short abbreviated names), but other
>> than that this is an excellent approach, and exactly why we created
>> datastores in the first place.
>>
>
> Is there somewhere a kind of datastore registry? How do I find out if
> there is already a SIP (or ISDN or whatever) datastore? If not IMO we
> should make this (at least a datastores.txt file somewhere in docs)
>
> Should the datastore (struct, free functions ...) be implemented inside
> chan_sip.c or is there another place for all the datastores?
>
> regards
> klaus
>
Most datastores are defined and implemented just in the module in which they are
used. Since in this case the only channel driver implementing the datastore is
chan_sip, I would suggest defining it in chan_sip.c. For the sake of not leaving
out information, though, there are a couple of datastores which must be accessed
in multiple modules, and those are defined the global_datastores.[ch] files.
By the way, I don't know if you have looked this deeply or not, but app_dial and
app_queue will copy a datastore from the incoming to any outgoing channels if
you have set the datastore's "inheritance" value to a positive value (I suggest
setting this to the constant DATASTORE_INHERIT_FOREVER), so step 3 of your plan
is already taken care of. :)
Mark Michelson
More information about the asterisk-dev
mailing list