260
260
/* additional info from message */
261
261
if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent
262
&& _m->user_agent->body.len > 0 && _m->user_agent->body.len < UA_MAX_SIZE) {
262
&& _m->user_agent->body.len > 0 && _m->user_agent->body.len < MAX_UA_SIZE) {
263
263
ci.user_agent = &_m->user_agent->body;
265
265
ci.user_agent = &no_ua;
929
int assign_server_unreg(struct sip_msg* _m, char* str1, str* direction) {
929
int assign_server_unreg(struct sip_msg* _m, char* str1, str* direction, char* route) {
930
930
str private_identity = {0, 0}, public_identity = {0, 0};
931
931
int assignment_type = AVP_IMS_SAR_NO_ASSIGNMENT;
932
932
int data_available = AVP_IMS_SAR_USER_DATA_NOT_AVAILABLE;
933
933
int require_user_data = 1;
935
935
tm_cell_t *t = 0;
937
938
saved_transaction_t* saved_t;
938
939
cfg_action_t* cfg_action;
940
sar_param_t* ap = (sar_param_t*) str1;
941
cfg_action = ap->paction->next;
941
udomain_t* _d = (udomain_t*) str1;
943
if (fixup_get_svalue(_m, (gparam_t*) route, &route_name) != 0) {
944
LM_ERR("no async route block for assign_server_unreg\n");
948
LM_DBG("Looking for route block [%.*s]\n", route_name.len, route_name.s);
949
int ri = route_get(&main_rt, route_name.s);
951
LM_ERR("unable to find route block [%.*s]\n", route_name.len, route_name.s);
954
cfg_action = main_rt.rlist[ri];
955
if (cfg_action == NULL) {
956
LM_ERR("empty action lists in route block [%.*s]\n", route_name.len, route_name.s);
943
960
LM_DBG("Assigning unregistered user for direction [%.*s]\n", direction->len, direction->s);
945
962
enum cscf_dialog_direction dir = cscf_get_dialog_direction(direction->s);
995
1012
saved_t->expires = 1; //not a dereg as this is server_assign_unreg
996
1013
saved_t->require_user_data = require_user_data;
997
1014
saved_t->sar_assignment_type = assignment_type;
998
saved_t->domain = (udomain_t*) ap->param;
1015
saved_t->domain = (udomain_t*) _d;
1000
1017
saved_t->contact_header = 0;
1044
1061
//int save(struct sip_msg* msg, udomain_t* _d) {
1046
int save(struct sip_msg* msg, char* str1) {
1063
int save(struct sip_msg* msg, char* str1, char *route) {
1048
1065
int require_user_data = 0;
1049
1066
int data_available;
1063
1083
contact_for_header_t* contact_header = 0;
1065
sar_param_t* ap = (sar_param_t*) str1;
1066
cfg_action = ap->paction->next;
1085
if (fixup_get_svalue(msg, (gparam_t*) route, &route_name) != 0) {
1086
LM_ERR("no async route block for assign_server_unreg\n");
1090
LM_DBG("Looking for route block [%.*s]\n", route_name.len, route_name.s);
1091
int ri = route_get(&main_rt, route_name.s);
1093
LM_ERR("unable to find route block [%.*s]\n", route_name.len, route_name.s);
1096
cfg_action = main_rt.rlist[ri];
1097
if (cfg_action == NULL) {
1098
LM_ERR("empty action lists in route block [%.*s]\n", route_name.len, route_name.s);
1068
1102
//check which route block we are in - if not request then we fail out.
1069
1103
if (!is_route_type(REQUEST_ROUTE)) {
1107
1141
expires = cscf_get_max_expires(msg, 0); //check all contacts for max expires
1108
1142
if (expires != 0) { //if <0 then no expires was found in which case we treat as reg/re-reg with default expires.
1109
if (is_impu_registered((udomain_t*) ap->param, &public_identity)) {
1143
if (is_impu_registered(_d, &public_identity)) {
1110
1144
LM_DBG("preparing for SAR assignment for RE-REGISTRATION <%.*s>\n", public_identity.len, public_identity.s);
1111
1145
sar_assignment_type = AVP_IMS_SAR_RE_REGISTRATION;
1135
1169
//unregister the requested contacts, if none left at the end then send a SAR, otherwise return successfully
1136
1170
LM_DBG("need to unregister contacts\n");
1137
1171
//lets update the contacts - we need to know if all were deleted or not for the public identity
1138
int res = update_contacts_new(msg, (udomain_t*) ap->param, &public_identity, sar_assignment_type, 0, 0, 0, 0, 0, &contact_header);
1172
int res = update_contacts_new(msg, _d, &public_identity, sar_assignment_type, 0, 0, 0, 0, 0, &contact_header);
1139
1173
if (res <= 0) {
1140
1174
LM_ERR("Error processing REGISTER for de-registration\n");
1141
1175
free_contact_buf(contact_header);
1190
1224
saved_t->expires = expires;
1191
1225
saved_t->require_user_data = require_user_data;
1192
1226
saved_t->sar_assignment_type = sar_assignment_type;
1193
saved_t->domain = (udomain_t*) ap->param;
1228
saved_t->domain = _d;
1195
1230
saved_t->public_identity.s = (char*) shm_malloc(public_identity.len + 1);
1196
1231
if (!saved_t->public_identity.s) {