MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / dm_send_custom_rpl

Function dm_send_custom_rpl

modules/aaa_diameter/dm_peer.c:512–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510
511
512int dm_send_custom_rpl(struct dm_message *dm)
513{
514 struct msg *ans = (struct msg *)dm->fd_req;
515 int rc, flags = 0;
516
517 if (!dm_server_autoreply_error && dm_remove_unreplied_req(ans) != 0) {
518 LM_ERR("unable to build answer, request is no longer available "
519 "(timeout: %d s)\n", dm_unreplied_req_timeout);
520 return -1;
521 }
522
523 if (dm->error_bit)
524 flags |= MSGFL_ANSW_ERROR;
525
526 rc = fd_msg_new_answer_from_req(fd_g_config->cnf_dict, &ans, flags);
527 if (rc != 0) {
528 LM_ERR("failed to create answer message, error: %d\n", rc);
529 goto error;
530 }
531
532 if (dm_server_autoreply_error)
533 FD_CHECK(fd_msg_rescode_set(ans, "DIAMETER_COMMAND_UNSUPPORTED",
534 "Command Not Implemented", NULL, 1));
535
536 /* App id */
537 {
538 struct msg_hdr *h;
539 FD_CHECK(fd_msg_hdr(ans, &h));
540 h->msg_appl = dm->app_id;
541 }
542
543 /* include all AVPs passed from script level */
544 if (!dm_server_autoreply_error && dm_pack_avps(ans, &dm->avps) != 0) {
545 LM_ERR("failed to pack AVPs\n");
546 return -1;
547 }
548
549 FD_CHECK(fd_msg_send(&ans, NULL, NULL));
550 FD_CHECK(fd_msg_free(ans));
551 return 0;
552
553error:
554 fd_msg_free(ans);
555 return -1;
556}
557
558
559static inline int dm_peer_send_msg(struct dm_message *msg)

Callers 2

dm_peer_send_msgFunction · 0.85
dm_receive_reqFunction · 0.85

Calls 2

dm_remove_unreplied_reqFunction · 0.85
dm_pack_avpsFunction · 0.85

Tested by

no test coverage detected