From: Steve K. <st...@st...> - 2004-01-21 14:33:30
|
Steven Sokol wrote: >>I think that IAX2 returns the message count as part of a registration >>reply as IAX_IE_MSGCOUNT. at least, that's what grep -i message * on >>libiax2 leads me to believe. >> >>-SteveK >> >> > >According to iax2-parser.c there is an IE for the message count. The >value apparently gets parsed out of the iedata and placed in a field of >the iax_ies structure called msgcount. It appears that this short field >is flooded (65535) if you have messages and zero if you don't. If you >don't have a mailbox, it seems to return -1. At least this is my best >guess. > >My next question is -- what is the best way to push this information to >our clients and to sync it with a particular server? I am "catching" it >as it comes through attached to the IAX_COMMAND_REGACK event in the >iaxc_handle_regreply function. If we could return some kind of event or >even a return value from iaxc_register that can be matched up with the >session or other identifier with the message count, we could indicate if >messages exist for multiple registrations. > >Perhaps returning an identifier (identifying the specific registration) >from the iaxc_register function could be useful for other reasons. For >example, we could match it to regauth/regreject messages and return an >acknowledgement for the specific server/registration in question. > >(Does this make any sense -- it's rather awkward to talk about.) > > OK, I'm CCing the iaxclient list only here, as this is iaxclient-specific stuff. I don't think it makes sense to have iaxc_register return this information, because then iaxc_register would need to block until a registration reply is received. And then, it would only return after the initial registration, and not subsequent refreshes. So, the solution needs to be more complicated than that. I think that the registration "system" in iaxclient needs to be greatly enhanced; I really just did it to see if it would work at all, because I didn't know how it worked. So, I think that perhaps what should be done is something along the following lines: 1) Create a "registration ID" for each registration. 2) Have iaxc_register return the registration ID. 3) Have a new event type "regstatus" that gets passed back to clients, which will report whenever a particular registration has succeeded or failed, and in this event, we can pass up the message count, and any other information that needs to be passed back up. Maybe also the event could send back a "count" to the client, so they can know if this is the first regstatus event they're seeing for a particular registration; they may want to notify the user for that.. 4) Add a new function iaxc_regcancel, which takes a registration ID, and tells the client to stop trying to register that address; there's currently no way to do that. Clients would then call iaxc_register, and then they should soon get back a regstatus event. They'd also get regstatus events every so often (whatever the registration interval is). -SteveK >Mark - Why return a yes/no/error value, rather than the actual message >count or -1 for no mailbox? > > |