def extract_phone_from_sip_uri(sip_uri):
    """Extract phone number from SIP URI.

    Args:
        sip_uri: SIP URI in format "sip:+17868748498@daily-twilio-integration.sip.twilio.com"

    Returns:
        Phone number string (e.g., "+17868748498") or None if invalid format
    """
    if not sip_uri or not isinstance(sip_uri, str):
        return None

    if sip_uri.startswith("sip:") and "@" in sip_uri:
        phone_part = sip_uri[4:]  # Remove 'sip:' prefix
        caller_phone = phone_part.split("@")[0]  # Get everything before '@'
        return caller_phone
    return None
Extract phone number from SIP URI.

    Args:
        sip_uri: SIP URI in format "sip:+17868748498@daily-twilio-integration.sip.twilio.com"

    Returns:
        Phone number string (e.g., "+17868748498") or None if invalid format
    
examples/phone-chatbot/daily-twilio-sip-dial-out/server.py