| 210 | } |
| 211 | |
| 212 | void get_reply_status( str *status, struct sip_msg *reply, int code ) |
| 213 | { |
| 214 | str phrase; |
| 215 | |
| 216 | status->s=0; |
| 217 | |
| 218 | if (reply==0) { |
| 219 | LM_CRIT("called with 0 msg\n"); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | if (reply==FAKED_REPLY) { |
| 224 | phrase.s=error_text(code); |
| 225 | phrase.len=strlen(phrase.s); |
| 226 | } else { |
| 227 | phrase=reply->first_line.u.reply.reason; |
| 228 | } |
| 229 | status->len=phrase.len+3/*code*/+1/*space*/; |
| 230 | status->s=pkg_malloc(status->len+1/*ZT */); |
| 231 | if (!status->s) { |
| 232 | LM_ERR("no pkg mem\n"); |
| 233 | return; |
| 234 | } |
| 235 | status->s[3]=' '; |
| 236 | status->s[2]='0'+code % 10; code=code/10; |
| 237 | status->s[1]='0'+code% 10; code=code/10; |
| 238 | status->s[0]='0'+code % 10; |
| 239 | memcpy(&status->s[4], phrase.s, phrase.len); |
| 240 | status->s[status->len]=0; |
| 241 | } |
no test coverage detected