On 01/01/2010 11:48 AM, Antonio Goméz Soto wrote:
Right. I see now. It can only send out requests which it has received, and not create new ones. But on the other hand, kamailio *does* keep dialog state, so might it be possible to create some add-on module, that injects fake messages into the input stream? Using info that is in the dialog state? Or.. come to think of it, would that mess up the dialog between the endpoint, because it would increment counters that are maintained by the endpoint?
Yes, it would most likely interfere with the statekeeping done by the endpoints.
The question you are asking is a technical one, but the answer is really philosophical and conceptual one (i.e. in terms of how RFC 3261 defines various types of SIP elements). Is it theoretically possible to add some hacks to a SIP proxy to make it behave as something other than a proxy by spoofing messages in a convincing way? Yes, it is - with enough ambition; in fact, Kamailio has a number of such hacks internally, such as the dialog module's timeout attribute which can spoof a BYE in both directions after a certain amount of time has passed. But that's what they are - hacks. Useful, perhaps, but they are departures from what a proxy is supposed to do that break proxy purity.
So, yes, you could hack the source to inject messages asynchronously. But when you do that, you no longer have a proxy, but something else, so it really comes down to (a) what you want and (b) what the product is intended to be. At the moment - several clever hacks notwithstanding, and some UAS functionality (e.g. registrar) notwithstanding as well - it's a proxy. As long as the intent of the product is to continue to be a proxy, it is largely limited to the sort of things a proxy can do, formally speaking.
To do the kinds of things you're wanting to do in a way that is accommodated by the specifications and the protocol mechanics of SIP, what you're really looking for is something that can behave as a user agent in its own right.