This would be better, but untested:
const char *msg;
pulseDuration = pulseIn(channelInPin, HIGH, 3000); //get the channel level
p("Pulse Duration", pulseDuration);
if (pulseDuration > 1900 && pulseDuration < 2200)
{
msg = "1";
p("Sending",1);
}
else
{
msg = "2";
p("Sending",0);
}