networking · intermediate · ~15 min
Parse a SIP response status.
A SIP response line looks like SIP/2.0 200 OK. Implement int sip_status_code(const char *line) returning the numeric status, or -1 if it doesn't start with SIP/.
#include <string.h>
#include <stdlib.h>
int sip_status_code(const char *line) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.