| 229 | } |
| 230 | |
| 231 | int t_resume_async_reply(int fd, void*param, int was_timeout) |
| 232 | { |
| 233 | async_tm_ctx *ctx = (async_tm_ctx *)param; |
| 234 | struct cell *backup_t; |
| 235 | struct usr_avp **backup_list; |
| 236 | struct cell *t= ctx->t; |
| 237 | int route; |
| 238 | int msg_status; |
| 239 | int last_uac_status; |
| 240 | int branch; |
| 241 | struct ua_client *reply_uac; |
| 242 | |
| 243 | if (valid_async_fd(fd)) |
| 244 | LM_DBG("resuming reply on fd %d, transaction %p \n", fd, t); |
| 245 | else |
| 246 | LM_DBG("resuming reply without a fd, transaction %p \n", t); |
| 247 | |
| 248 | |
| 249 | |
| 250 | /* enviroment setting */ |
| 251 | current_processing_ctx = ctx->msg_ctx; |
| 252 | backup_t = get_t(); |
| 253 | |
| 254 | /* make available the avp list from transaction */ |
| 255 | backup_list = set_avp_list( &t->user_avps ); |
| 256 | |
| 257 | /* avoid double lookup of our branch, just get it from ctx */ |
| 258 | branch=ctx->branch; |
| 259 | |
| 260 | /* fake transaction */ |
| 261 | set_t( t ); |
| 262 | |
| 263 | msg_status=ctx->reply->REPLY_STATUS; |
| 264 | reply_uac=&TM_BRANCH( t, branch); |
| 265 | LM_DBG("org. status uas=%d, uac[%d]=%d local=%d is_invite=%d)\n", |
| 266 | t->uas.status, branch, reply_uac->last_received, |
| 267 | is_local(t), is_invite(t)); |
| 268 | last_uac_status=reply_uac->last_received; |
| 269 | |
| 270 | _tm_branch_index = branch; |
| 271 | |
| 272 | async_status = ASYNC_DONE; /* assume default status as done */ |
| 273 | |
| 274 | /* we run the resume callback under lock, if needed |
| 275 | * the resume function might touch the AVP list, so |
| 276 | * we need to protect that from other incoming replies on this transaction */ |
| 277 | if (onreply_avp_mode) |
| 278 | LOCK_REPLIES(t); |
| 279 | |
| 280 | /* call the resume function in order to read and handle data */ |
| 281 | return_code = ((async_resume_module*) |
| 282 | (was_timeout ? ctx->async.timeout_f : ctx->async.resume_f)) |
| 283 | ( (valid_async_fd(fd) ? fd: ASYNC_FD_NONE), ctx->reply, |
| 284 | ctx->async.resume_param ); |
| 285 | |
| 286 | if (async_status==ASYNC_CONTINUE) { |
| 287 | /* do not run the resume route */ |
| 288 | if (onreply_avp_mode) |
no test coverage detected