nice, how do you pick the last number only, or would it be better when
you stored a missed call, that you deleted other entries in the table.
Iqbal
Andreas Granig wrote:
Iqbal wrote:
I never got round to tying this, just got bogged
down with other
configs, if you have any luck give me a shout, I might take a look
towards the end of the week
I played around a little with it and got it to work with SER 0.9.x.
Here is the config snippet (assuming you use 1000(a)your.domain for
callbacks):
modparam("avpops", "use_domain", 1)
modparam("avpops", "avp_url",
"mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "dummy") # it complains if
not set
modparam("avpops", "avp_aliases","callback=i:995")
route {
# the usual stuff like basic checks, NAT fixes and proxy
# authentication goes here...
# check for callback
if(uri =~ "^sip:1000@") {
# load callback-avp from callback table
if(avp_db_load("$from", "$callback/callback")) {
avp_pushto("$ruri", "$callback");
avp_db_delete("$from", "$callback/callback");
avp_delete("$callback");
} else {
# announcement that no callback available or a 4xx reply
# goes here...
}
}
# lookup aliases and location here...
# if it's a call to a local user, prepare for storing callback
t_on_failure("2");
# then do some additional stuff and t_relay() here...
}
failure_route[2] {
# set callback if callee is busy or N/A
if(t_check_status("480|486") && method == "INVITE") {
# store caller into callback table
avp_write("$from", "$callback");
avp_db_store("$ruri", "$callback/callback");
avp_delete("$callback");
}
}
And here's the callback table for MySQL:
CREATE TABLE `callback` (
`uuid` varchar(64) NOT NULL default '',
`username` varchar(100) NOT NULL default '',
`domain` varchar(128) NOT NULL default '',
`attribute` varchar(32) NOT NULL default '',
`value` varchar(128) NOT NULL default '',
`type` int(11) NOT NULL default '0',
`modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
PRIMARY KEY (`username`,`domain`,`attribute`,`value`)
);
Hth,
Andy
.