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

Function ospGetFromDisplay

modules/osp/sipheader.c:196–224  ·  view source on GitHub ↗

* Get display name from From header * param msg SIP message * param fromdisplay Display name of From header * param bufsize Size of fromdisplay buffer * return 0 success, -1 failure */

Source from the content-addressed store, hash-verified

194 * return 0 success, -1 failure
195 */
196int ospGetFromDisplay(
197 struct sip_msg* msg,
198 char* fromdisplay,
199 int bufsize)
200{
201 struct to_body* from;
202 int result = -1;
203
204 if ((fromdisplay != NULL) && (bufsize > 0)) {
205 fromdisplay[0] = '\0';
206 if (msg->from != NULL) {
207 if (parse_from_header(msg) == 0) {
208 from = get_from(msg);
209 if ((from->display.s != NULL) && (from->display.len > 0)) {
210 ospCopyStrToBuffer(&from->display, fromdisplay, bufsize);
211 result = 0;
212 }
213 } else {
214 LM_ERR("failed to parse From header\n");
215 }
216 } else {
217 LM_ERR("failed to find From header\n");
218 }
219 } else {
220 LM_ERR("bad parameters to parse display name from From header\n");
221 }
222
223 return result;
224}
225
226/*
227 * Remove user parameters from userinfo

Callers 2

ospReportUsageFromCookieFunction · 0.85
ospRequestRoutingFunction · 0.85

Calls 2

parse_from_headerFunction · 0.85
ospCopyStrToBufferFunction · 0.85

Tested by

no test coverage detected